Jun 11, 2008

CSS Selector Performance

Filed under CSS, Performance

Jon Sykes has investigated the performance of child selectors in a series of tests. Read Part 1, Part 2, and Part 3.

While his findings show that type and class selectors are rendered more rapidly than descendant and child selectors, the example files are (necessarily) exaggerated in order to demonstrate the performance impact.

I’d like to see a well-coded, real-world example (one which balances type, class, and ID selectors with descendant and child selectors) vs. an example that exploits the use of class selectors (and is probably less efficient over all due to excess code) — I would guess that they’d perform about the same. And, as pointed out elsewhere, the well-coded solution will be easier to maintain in the long run, which would well be worth the extra milliseconds on the client.

Comments (0)

You can leave a comment or pingback.

Reply to “CSS Selector Performance”

What is the Circle of Standards?

A methodology that enables the successful adoption and continued implementation of standards by addressing their management, related training and communication, and continual review. Learn more.

Search the Circle of Standards

Organizations and Efforts

  • Ecma International - Facilitates the timely creation of a wide range of global Information and Communications Technology (ICT) and Consumer Electronics (CE) standards
  • Email Standards Project - Works with email client developers and the design community to improve web standards support and accessibility in email.
  • Web Standards Project - A grassroots coalition fighting for standards which ensure simple, affordable access to web technologies for all.
  • World Wide Web Consortium - Develops interoperable technologies to lead the Web to its full potential

Recommended Reading

  • Web Redesign 2.0 - This Core Process applies to all design and redesign projects, from the simplest to the most complex.
  • Web Style Guide - A practical guide to help you design Web sites for the long run.

Subscribe to the Circle

Keep up with all of the news, links, useful tips and more, via RSS or email.

Using the Circle to Adapt to Web Standards

Adapting to Web Standards: CSS and Ajax for Big Sites

Adapting to Web Standards: CSS and Ajax for Big Sites features an instructional chapter on the Circle of Standards. By Christopher Schmitt, Kimberly Blessing, et al.