Reputation: 6107
If I have the following HTML:
<div id="container">
<div id="inner">
</div>
</div>
Is there any difference , performance wise, between:
#container #inner {
width:300px;
}
to
#inner {
width:300px;
}
?
Upvotes: 0
Views: 180
Reputation: 15172
As id
s aren't supposed to repeat, you can simply select using #inner
Upvotes: 1
Reputation: 3198
wont really affect it,
just CSS selectors with a wide-matching key selector can hurt performance ..
some insight here: http://www.stevesouders.com/blog/2009/06/18/simplifying-css-selectors/
Upvotes: 1
Reputation: 21630
The performance difference will be inconsequential. Try optimizing other parts of your code!
That being said, it's generally best to be as non-specific as possible.
Upvotes: 3