Are there any good reasons for using hex over decimal for RGB colour values in CSS?

前端 未结 12 2842
庸人自扰
庸人自扰 2020-12-01 07:17

rgb(255,255,255) notation has been available since CSS1. But #ffffff seems to be vastly more popular.

Obviously it\'s slightly more compact

12条回答
  •  囚心锁ツ
    2020-12-01 07:43

    HEX is most common due to historical reasons.

    Before CSS was common in web development, colors were specified within HTML tags and the most commonly used and supported way to specify a color was to use HEX values.

提交回复
热议问题