Performance differences between color declarations?

前端 未结 6 1531
死守一世寂寞
死守一世寂寞 2020-12-08 14:49

In CSS we can use several different methods to define a color:

  • Color word: red
  • Hexadecimal: #FF0000
  • Red/Green/Blue
6条回答
  •  悲&欢浪女
    2020-12-08 15:33

    Typically, css optimization is all about minimizing the number of bytes going over the wire. The hexadecimal colors tend to be the shortest (in your example, #f00 could be used instead of #ff0000).

    I realize this isn't exactly answering the question you've asked but I haven't seen any browser tests which attempt to measure how different color representations affect rendering speed.

提交回复
热议问题