In the CSS files, is it better to put the color code or put its name in letters? I mean at the loading level of the styles.
For example, does it make the same to put color: white;
that color: #fff;
?
Which of them would load faster?
In the CSS files, is it better to put the color code or put its name in letters? I mean at the loading level of the styles.
For example, does it make the same to put color: white;
that color: #fff;
?
Which of them would load faster?
From what I've read on the internet, the best practice is to use 6-digit hexadecimal code (not case sensitive).
If you use non-primary colors, it may be that depending on the browser you use, they have different colors defined.
On the other hand, if you want to add small modifications to the colors, the rgba colors are also used:
rgba(255,255,255,0.8);
That0.8
at the end is a parameteralpha
to give more or less opacity to the color.I consider that both with one format and with another the system works correctly, however putting the hexadecimal code ( #fff ) may be a bit faster. All the best
There is no better or worse answer. Simply agree with your team on a standard and stick to it.
Or just when you start on an existing project some of these standards will probably be used and you will have to follow them.
Note that the names for colors were extended with the CSS3 specification. Here you can see a complete list.
In particular, it seems to me that there are more than enough names for any project. So working only with color names seems like a perfectly valid option to me.
What sometimes happens is that the design does not depend on you, and many times you have to implement something that a layout artist has asked you to do, using specific colors that you cannot/should not change. And if that color doesn't have a name within the CSS3 standard, you should use rgb/rgba/hex.