Starting with CSS
Faruk Ateş provides a set of CSS rules to use as a starting point in Starting with CSS: revisited.
Why reset the margins and padding of specific element types instead of using the universal selector (*) to set everything to zero? Two reasons:
- Some browsers have default values for the margin and padding of form elements. Setting them to zero is not always a good idea.
- Since the universal selector matches every element in the document tree, it can slow things down.
Those are valid enough reasons, and I’ve started using a set of starting rules similar to those in Faruk’s example.
- Previous post: Print-friendly CSS and usability
- Next post: Web Standards Are Your Responsibility
Subscribe / follow
Sponsors
Authentic Jobs
- Front End Developer at CafeMom (New York, NY, Ne, US)
- WordPress Developer at Maskar Design (Philadelphia, PA, Pe, US)
- Senior Front End Developer at Synacor, Inc. (Buffalo, NY, Ne, US)
- Mobile Product Designer, Android at Etsy (Brooklyn, NY, Ne, US)
DreamHost web hosting
Use the promo code 456BEREASTREET3 to save USD 20 when you sign up for DreamHost


Comments
Faruk and I had some interesting discussions about this while, and after, he put his article together.
I’m all for it, but I’m also still interested in the actual slowing down effect the universal selector would have in a web browser. Are there any benchmark tests?
Why I’m asking is since high-profile CSS gurus (people like Eric Meyer) use the universal selector, and they, if any, should be aware of all possible side effects.
Noooo! The star selector has been the foundation of my CSS for some time! :)
I also like to see some testing performed on the ‘slowing down effect’. I’d like to know whether or not the difference is negligible before I begin recoding. :)
Stuart,
Developers of browsers have said they can see a slow down, but so far, I don’t think anyone has made test cases of websites where there is a noticeable difference. However, there is still the form control element issue that you get from using * {}, as well as the fact that it’s just not Best Practice to do that in the first place :-)
Comments are disabled for this post (read why), but if you have spotted an error or have additional info that you think should be in this post, feel free to contact me.