Hacker News new | ask | show | jobs
by pothibo 4645 days ago
Nice article! One more important reason why to use class instead of tags: CSS rules are read from right to left. That means the browser will first gather all the h[1-6] and then it will filter the headers down with the other rules from there.

If your CSS rules are applied to classes, it will gather the classes first then filter it down (Resulting in a smaller set in the first place).

CSS processing will be much faster.

1 comments

That is so true. Github had a lot of performance issues in their diff pages and they solved by using one-to-one mapping class-names and keeping the specificity as low as possible. Here's more on that: https://speakerdeck.com/jonrohan/githubs-css-performance?sli...