CSS: What's the meaning of short color specifications like #FFF instead of #FFFFF?
Question by Guest | 2014-02-03 at 10:02
Some years ago in school, I have learned that hexadecimal RGB color specifications always have six digits. So, for example 6-digit values like #FFFFF, #00000 or #CA03EE.
However, when browsing the source code of several website, quite often, I can see 3-digit specifications such as #FFF or #000.
So, what's it all about? Is that even allowed? And how can you convert the information from one system into the other?
Related Topics
CSS: Include CSS Stylesheets in HTML
Tutorial | 0 Comments
CSS: Why is DarkGray brighter than Gray?
Info | 0 Comments
CSS: Colorize Table Rows Alternately only with CSS
Tutorial | 0 Comments
Website Performance: Deliver JavaScript and CSS files compressed to reduce loading times
Tutorial | 0 Comments
Color Values: Convert RGB, CMYK, CMY, HSV, TColor and XYZ Values
Tutorial | 0 Comments
Pipette: Fetch Colors from all over the Screen
Tutorial | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
#FFF is just a short form of #FFFFFF. These short values are easier to write and they need less space and memory.
Whenever a hexadecimal color specification consists of equal pairs, you can use such an abbreviation. For example, the color #AA00FF can be shortened to #A0F, but it is not possible to abbreviate the color #A00AFF because this color consists of the RGB parts A0 0A and FF which are not only pairs.
I do not know any browser not understanding this values, so it is your turn whether you would like to use this shorter values or not. There will be no difference in the appearance of a website depending on which of the values you are using.
2014-02-03 at 17:59