According to new article from css-tricks there is a big difference between how you select your elements because they are selected from right to left.
The article can be found here. http://css-tricks.com/efficiently-rendering-css/
I am about to create a page that have different documents on the same page:
My question is, how should i go about the HTML for CSS efficiency or vise versa?
<div class="document-type-1">
<h1>Some heading</h1>
<p>Some paragraph</p>
</div>
<div class="document-type-2">
<h1>Some heading</h1>
<p>Some paragraph</p>
</div>
There can be multiple of the same document type, i can therefore not use an ID.
.document-type-1 h1 {
}
.document-type-1 p {
}
.document-type-2 h1 {
}
.document-type-2 p {
}
This will be "inefficient" since all p tags are found first...
How would you go about it if this should be done faster and you should be able to move the same article to a new document type?