Grow your CSS skills. Land your dream job.

Why Browsers Read Selectors Right to Left

Published by Chris Coyier

When I first learned that browsers read CSS selectors from right to left it felt kinda weird and confusing. Boris Zbarsky explains why it's done that way in a way that makes perfect sense. Part of the reason:

...most of the selectors it's considering don't match the element in question. So the problem becomes one of deciding that a selector doesn't match as fast as possible; if that requires a bit of extra work in the cases that do match you still win due to all the work you save in the cases that don't match.

Direct Link →

*May or may not contain any actual "CSS" or "Tricks".