Reputation: 2453
Is it a good habit to use in CSS universal selector to set some properies of many elements. I mean, for instance:
* {margin: 0; padding: 0;}
Maybe default values are logical and we shouldn't change them all in the one line.
Upvotes: 0
Views: 455
Reputation: 6056
This issue with the universal selector is that you are going to remove some potentially useful browser defaults on some elements, just to have to explicitly add them back at a later time.
In other words, a user is going to have to download a CSS style to put back padding or margin on an element that already had perfectly acceptable padding or margin without any download.
If you are looking to make elements render the same across all browsers, I would suggest you check out normalize.css, which tries to keep as many browser defaults in place as it can.
Upvotes: 2
Reputation: 2581
The universal selector is good for troubleshooting. If absolutely stumped on elements that are causing overflow issues I'll do * {border:1px solid pink}
. Be sure to remove once troubleshooting is complete.
Upvotes: 2
Reputation: 400
The universal selector does cause a performance issue so try to avoid it.
Upvotes: 1