Results 1 to 3 of 3

Thread: Style reset - specifying elements vs asterisk

  1. #1
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default Style reset - specifying elements vs asterisk

    Hello everyone!

    I was wondering why most style resets specify all the elements instead of just using an asterisk. Here is an example:
    http://meyerweb.com/eric/thoughts/2008/01/15/resetting-again/

    Now I'm sure there is a reason, but what is it? I've always used an asterisk style reset and haven't encountered any problems that I can think of.

    Thanks!
    Last edited by Snookerman; 04-21-2009 at 06:50 AM. Reason: added "Resolved" prefix

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    In the example from your link, though a bit overdone (the guy must love to hear himself type), there are some style resets that would technically be invalid for for some elements. But even that shouldn't be too much of a problem. In most cases (if using just *) they will just be ignored for those elements that they don't apply to. Where they may cause a problem, they could be included only after the * declaration, and only for the element(s) to which they would apply.

    However, to be on the safe side (if your object is the fullest possible compatibility), it can't hurt to write everything out, being as specific as possible. That way you don't have to test every browser in the world to see how it reacts to the * reset.

    That said, I can think of no browser that would have a problem with it (the * reset), as long as things like border-collapse were reserved for table, etc., and perhaps not even that should be a concern.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    After a bit of searching and a lot of browsing through heaps of comments I have found some answers. The main arguments against the asterisk seem to be parsing speed (µs difference so not that important) and form elements. Apparently removing the padding and margins from form elements, especially the input element, can cause some problems. Some answers can be found in the comments of this article:
    http://nettuts.com/html-css-techniques/weekend-quick-tip-create-your-own-resetcss-file/

    Regarding the example I posted, it's actually the most popular css reset. Google for "css reset" or "style reset" and it's the first hit. Also, all the articles and tutorials that deal with style resets link to that one.

    I also found some articles that are against resets, the first one somewhat advocating the asterisk reset:
    http://meiert.com/en/blog/20080419/reset-style-sheets-are-bad/
    http://snook.ca/archives/html_and_css/no_css_reset/

    I must say, I really don't know which way to go with this. I think that for now, I'll stick my * {margin:0; padding:0;} reset until I hit the wall with form elements.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •