Efficiency of color selection in html. RGB vs hex vs name

后端 未结 3 1951
轻奢々
轻奢々 2021-02-04 04:04

Is there a difference in the speed a browser can parse a colour?

for example, the colour red, i could use the following css:

.red
{
    color:red;
    co         


        
3条回答
  •  鱼传尺愫
    2021-02-04 04:20

    You will be unable to measure any difference in the three options on any non-trivial web page.

    The cost of downloading and parsing a few more or a few less bytes is tiny compared to the cost of downloading, parsing and rendering the the page.

    The performance measurements provided by @Vinny support that.

    The only reason im asking this is literally everything on a website has varying colours

    If you can optimize your CSS so as to not specify the color in many different places (use inherited properties where you can), that is likely to have a larger impact on overall performance (less CSS to download and parse).

提交回复
热议问题