I'm trying to understand exactly how and in what order CSS is processed by the browser. I already know CSS is read from right to left, but more specifically, I want to know if:
- The browser goes through each element in the DOM, and for each element, scans through the CSS rules to find which style matches?...or if:
- The browser goes through each CSS rule and for each selector, scans through the DOM to find a DOM element that matches that selector?
(Or perhaps this even varies between browsers?)