How can I use 3-digit color codes rather than 6-digit color codes in CSS?

后端 未结 9 1559
余生分开走
余生分开走 2020-12-02 12:22

I recently went through my CSS file and switched all my six-digit hexadecimal codes to simple three-digit codes (for example, my #FDFEFF got shortened to

9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-02 12:29

    Shorthand sucks! Don't use it. It's harder to maintain and creates unnecessary variation e.g. when searching and replacing a colour value ("oh, now I have to take into consideration #FFFFFF and white and #FFF").

    What you save in size is never worth what you lose in maintainability. Use minifaction and compression to save bandwidth.

提交回复
热议问题