It is recommendable to type the color's name instead of its hex value in CSS?

后端 未结 7 1339
南笙
南笙 2020-12-11 02:38

I always forget what colors I\'m dealing with in CSS when I see it hex value. I would like to use the name instead (e.g color: lightgreen). Is it supported by all browsers?

相关标签:
7条回答
  • 2020-12-11 03:12

    You could always add comments to your CSS file so instead of:

    .my_class {
        color: orange;
    }
    

    You could write:

    .my_class {
        color: #ffa500; /* Orange */
    }
    

    This way you know for sure the colour will be exactly the same in every browser and you see the name as well.

    0 讨论(0)
提交回复
热议问题