tags:

views:

50

answers:

3

You can do this:

.info
{
    padding: 5px ;
}

Or, if you know it will be a div, you can do this

div.info
{
    padding: 5px ;
}

So, when there's a nested list.. you can do this..

div.info ul.navbar li.navitem a.sitelink
{
    color: #f00;
}

Or you can do this

a.sitelink
{
    color: #f00;
}

Readability aside, which is better for the browser to parse/run?

+3  A: 

Keep rules as general as possible -- it is faster and uses less bytes. See Google's article for more info.

Coronatus
I posted the same as you, about the exact same time too :) We even both linked to google.
Echo
@Echo There's a full minute apart. In SO time, that is lightyears :)
Josh Stodola
@Josh True, true :)
Echo
+1  A: 

I believe the most specific and shortest is almost always the best.

see http://code.google.com/speed/page-speed/docs/rendering.html

Echo
A: 

Keep rules simple and general as possible is a good start. Someone else will have to read it and make sense of it at some point.

If you are concerned about browser speed performance, stylesheet size, etc? Just run your style-sheets through YUICompressor. It will clean up and minify your CSS (group things together that are repeated for example).

subv3rsion
FYI. Just because the CSS is minified and optimized in YUICompressor does not give you free reign to be sloppy. The Google article, mentioned already, is a good start.
subv3rsion