3 ms·
For your first example, I would argue the following is better. You reduce repetition of the class name and keep the semantic value of having a list <ul cla
by 4lun 14y ago
For your first example, I would argue the following is better. You reduce repetition of the class name and keep the semantic value of having a list
<ul class="social-links">
<li><a href="#" class="twitter">Twitter</a></li>
<li><a href="#" class="facebook">Facebook</a></li>
<li><a href="#" class="dribble">Dribbble</a></li>
<li><a href="#" class="gplus">Google+</a></li>
</ul>
You would need to have a scary size document to reap the benefit of reducing your element nesting level by that little.
Also if you don't want to commit to having a h1 as always being the header, using a class for the styling would be beneficial.
<h1 class="header">header</h1>
Or depending on your situation you might want to use a header tag.
- 8ig8 14y agoI think OOCSS has a strong influence on this use of multiple classes instead of your example of nesting classes (which i would have done, too). I'm not saying I totally agree, but OOCSS promotes the idea that your styles should be decoupled from your HTML structure. This makes CSS easier to maintain.
- progrock 14y agoOr maybe better, a fictitious attribute... <a action="share">Share this article.</a> Or better still, just have that as an option in the browser. Tada - 100% minimisation!
- justinsteele 14y agoHe was using the example from the article - did you read it?