Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Difference between these CSS reset methods

Difference between these CSS reset methods

Problem

I would like to know if there is any difference between these two methods.

body,ul,li,p,h1,h2,h3,h4,h5{padding:0; margin:0; list-style-type:none;}

and

body,ul,p,h1,h2,h3,h4,h5{padding:0; margin:0;}
li{list-style-type:none;}

without the need to use the global selector * The real issue here is that, I have mentioned list-style-type:none; in the first example, even though this attribute applies to the li tag on. But, I find myself something in need to group all elements and just give them values , even if some values don't apply to some elements.

So, is there a negative side to that aside from clarity issues?

Problem courtesy of: ANW

Solution

I would go with the second Reset.. although I always use Eric Meyers..

The first reset applies padding:0; margin:0; list-style-type:none; to all the tags. This is really redundant, as list-style-type:none has absolutely no effect on h1, h2, etc. Why apply it if it has no effect on those elements? Don't.

list-style-type:none only has effect on

    and
  • therefore it should only be applied to those, as in the second example.

    Of those 2 options, use the following:

    body,ul,li,p,h1,h2,h3,h4,h5{padding:0; margin:0;}
    ul,li{list-style-type:none;}
    
    Solution courtesy of: Josh Crozier
  • Discussion

    View additional discussion.



    This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

    Share the post

    Difference between these CSS reset methods

    ×

    Subscribe to Css3 Recipes - The Solution To All Your Style Problems

    Get updates delivered right to your inbox!

    Thank you for your subscription

    ×