Browsers parse CSS selectors from right-to-left to optimize performance when matching styles to DOM elements. During the creation of the render tree, the browser must find which CSS rules apply to each DOM element.
Parsing from right-to-left is more efficient because the rightmost selector is typically the most specific. By identifying the target elements first and then walking up the DOM tree to verify their ancestors, the browser can quickly discard large numbers of non-matching paths. In contrast, a left-to-right approach would traverse from ancestors down to leaves, often discovering a path is non-matching only at the final element, leading to significant wasted computation and potential page lag.