Is the CSS star selector considered harmful (and why)?

When it comes to performance, Steve Souders is the man:

Shameless quote from one of the reports:

The key to optimizing CSS selectors is
to focus on the rightmost selector,
also called the key selector
(coincidence?). Here’s a much more
expensive selector: A.class0007 * {}.
Although this selector might look
simpler, it’s more expensive for the
browser to match. Because the browser
moves right to left
, it starts by
checking all the elements that match
the key selector, “*“. This means the
browser must try to match this
selector against all elements in the
page.

[bold emphasis mine]

Leave a Comment