Which CSS selectors or rules can significantly affect front-end layout / rendering performance in the real world?

后端 未结 6 2161
情书的邮戳
情书的邮戳 2020-12-12 11:56

Is it worth worrying about CSS rendering performance? Or should we just not worry about efficiency at all with CSS and just focus on writing elegant or main

6条回答
  •  感情败类
    2020-12-12 12:37

    While it's true that

    computers were way slower 10 years ago.

    You also have a much wider variety of device that are capable of accessing your website these days. And while desktops/laptops have come on in leaps and bounds, the devices in the mid and low end smartphone market, in many cases aren't much more powerful than what we had in desktops ten years ago.

    But having said that CSS Selection speed is probably near the bottom of the list of things you need to worry about in terms of providing a good experience to as broad a device range as possible.

    Expanding upon this I was unable to find specific information relating to more modern browsers or mobile devices struggling with inefficient CSS selectors but I was able to find the following:

    1. http://www.stevesouders.com/blog/2009/03/10/performance-impact-of-css-selectors/

      Quite dated (IE8, Chrome 2) now but has a decent attempt of establishing efficiency of various selectors in some browsers and also tries to quantify how the # of CSS rules impacts page rendering time.

    2. http://www.thebrightlines.com/2010/07/28/css-performance-who-cares/

      Again quite dated (IE8, Chrome 6) but goes to extremes in inefficient CSS selectors * * * * * * * * * { background: #ff1; } to establish performance degradation.

提交回复
热议问题