Welcome to Centmin Mod Community
Become a Member

WebPerf CSS PageSpeed Css :not Pseudo Elements (bad)

Discussion in 'Web Development & Web Performance' started by Brad393, Nov 15, 2020.

  1. Brad393

    Brad393 New Member

    13
    4
    3
    Oct 6, 2020
    Ratings:
    +8
    Local Time:
    9:15 PM
    PSA, don't chain them together like :not(.class1):not(.class2):not(.class3). It kills your styling/layout time on mobile tests lighthouse/pagespeed insights where CPU is limited and can make it look like other stuff is taking a long time and block more than it really is. WPT iOS also improved well after the removal of those. I had two rules with like 5 or so :not or :not or :not etc.... Yeah probably was stupid to do that but I am a total amateur and it seemed the efficient way CSS wise at the time for what I was doing.


    It took me a while to figure out that was the performance problem. Now that I rewrote the rules to instead target all the things I want only instead of too many things and then :not the things I didn't want, I am getting much improved times overall for FCP and blocking time because style and layout was over 2500ms sometimes before :wtf: on PageSpeed Insights.
     
  2. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    2:15 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    Thanks for the heads up though CSS isn't my wheel house :)

    Another one related to CSS is CSS Containment Helping Browsers Optimize With The CSS Contain Property — Smashing Magazine