main > section > main
just main.semantic-class main > section > main
just main.semantic-class <section class="body">
<main class="content"></main>
<aside class="sidebar"></aside>
</section>The top elements are one example. It makes no sense to include them inside any other element, and if that ever changes, all the styling will need to change anyway.
Not a good idea: IDs take massive priority over classes in the cascade.
As someone who often has to override an enormous stylesheet which is all styled to IDs, this is a serious pain point.
Simple example: http://jsfiddle.net/B7tSz/
Since large projects will inevitably have to rely on non-semantic HTML and class names anyway (e.g. to differentiate between sibling <p> tags), a simple rule of thumb would be to only use class names in selector construction. HTML elements can still be semantic for other purposes, but the CSS should not care about it.
The other half of the specificity problem is nesting. I advocate strongly against the descendant combinator ` ` in favor of the child combinator `>`. E.g. `.body > .content` is much more robust than `.body .content`. However, an alternate approach would be:
<section class="body">
<main class="body-content"></main>
<aside class="body-sidebar"></aside>
</section>
Either way, don't leave it up to individual developers. This has to be adopted by the team. main
> section
> main
text-decoration blink
Thus, things that are easy to change in HTML structure (cutting, pasting, and changing indentation) are similarly easy to change in CSS.