Efficient of CSS is not a new topic, also is not a topic that I have to pick up, however, it is a self in the SKY after work, really interested in and always focus on one topic.
a lot of people, or forget, or just don't realize that CSS can be efficient also can lead to low energy. However, we can not too little to consider when you think you will use the inefficient CSS this situation.
these rules only really used in high performance requirements of website, the website to speed requirement is very high, any page that may contain hundreds of thousands of DOM elements. But truth from practice, whether you're building the next facebook or in the development of a local display web pages, it's always good to learn more...

CSS selectors
code is as follows:


<Ul id="social" >
<LI> <A href="http://www.jb51.net//css/#" class="twitter" > Twitter </LI>
<LI> <A href="http://www.jb51.net//css/#" class="facebook" > Facebook </LI>
<LI> <A href="http://www.jb51.net//css/#" class="dribble" > Dribbble </LI>
<LI> <A href="http://www.jb51.net//css/#" class="gplus >" Google + </a> </LI>
</ul> CSS:
# social a {} now we changed to:
<Ul id="social" >
<LI> <A href="http://www.jb51.net//css/#" class="social - link twitter" > Twitter </LI>
<LI> <A href="http://www.jb51.net//css/#" class="social - link facebook" > Facebook </LI>
<LI> <A href="http://www.jb51.net//css/#" class="social - link dribble" > Dribbble </LI>
<LI> <A href="http://www.jb51.net//css/#" class="social - link gplus >" Google + </a> </LI>
</ul>

the corresponding CSS:
# social. Social cc-link {} this is a new key selector, match less element, means that the browser can more quickly find them and give them gift style.
at the same time, in fact, we can further streamline our selector, use. Social cc-link {}, without the need for a transition constraints on it; Read the next section for details.
so, in a nutshell, your key selector is one of the browsers work, so you need to pay attention to it properly.

excessive modified selector
code is as follows:


HTML body. The wrapper # content a {}

this option too flexors, there are at least three selectors are completely unnecessary. Concise style should be:
# content a {} so what?
this means that the browser needs to scan all the labels and check whether it contains an ID called &other; Content” Label, so keep to find in the HTML tag. This will lead to browser made redundant inspection work, and is totally unnecessary work. After knowing this, we can see closer to the actual examples:
# nav li a {} down to:
# nav a {} we know if the label inside the li tag, a li tag inside the # nav again, then we can remove the li from the selector. Then, because of the nav has an ID, this ID is unique, so it gives element is completely irrelevant, we can remove the ul.
overdone selector will lead to browser needs to do more work; From the selector to remove unnecessary parts, make your choice more concise, more efficient.
all of these are necessary?
the short answer is: probably not.
the longer answer is: it depends on what you are creating the web site. If you do in your next work, so beyond the CSS selector to pursue clean code performance, because you really don't want to pay attention to it.
if you are in the next version of the Amazon, to create a page speed of microseconds changes do have different, you may need to, but even that might not have.
the browser only CSS parsing speed is getting better and better, even the mobile browser. You probably have never noticed in the browser slowly CSS selectors, but...

it is still going on, no matter how much the browser quickly, they still must do all we talk about work. Even if you don't need to don't even want to implement any of them, of course it is still worth to know. Remember the selector may be costly, and where possible you should avoid using cost more selectors. That means, if you find that you wrote something such as:
div: NTH - of - the type (3) ul: last - child li: the NTH - of - type (odd) * {the font - weight: bold} so maybe you did wrong. Now I in a world of efficient selectors is a beginner, so if I missed anything, or do you have any need to add, please published it in the comments!

more about efficient CSS selectors# 0 - #


This concludes the body part