3 ms·
This code is very inefficient: .autobot > * { margin: auto; } Browsers match CSS selectors right-to-left. Because there is a * at the end, this ru
by flowerlad 6y ago
This code is very inefficient:
.autobot > * {
margin: auto;
}
Browsers match CSS selectors right-to-left. Because there is a * at the end, this rule has to be matched against every element.
More info:
https://stackoverflow.com/questions/5797014/why-do-browsers-match-css-selectors-from-right-to-left https://stackoverflow.com/questions/5797014/why-do-browsers-...
https://www.stevesouders.com/blog/2009/06/18/simplifying-css-selectors/ https://www.stevesouders.com/blog/2009/06/18/simplifying-css...
- nerdkid93 6y agoFrom my personal experience, CSS performance isn't really that much of a concern in the world of modern browsers. Maybe IE11 would hiccup on a particularly large page with 1,000s of DOM nodes, but all of the evergreen browsers are ridiculously performant with CSS. I'm not saying you should write queries like that, but if you must (for readability or technical reasons), it likely won't harm your site's performance.
- ArtDev 6y agoThis is a non-issue with modern browsers.