HTML Colors Hex values | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

HTML Colors Hex values

I do not get when the hashtag symbol (#) is followed by three hex characters? And when it is followed by six hex characters? I Also Would like to know if there is a specific rule for writing the Hex values?

6th Apr 2020, 2:27 PM
Ibrahim Samir Jibril
Ibrahim Samir Jibril - avatar
3 Answers
+ 3
Hex are Red Green Blue For three digit, each single digit is for one color, from 0 to 15. For six digit, each two digit is for two color, from 0 to 255. You don't have to memorizes anything. Use an online HTML color picker, or the color picker built-in in a code editor.
6th Apr 2020, 2:34 PM
Gordon
Gordon - avatar
+ 1
3 hex chars is a shorcut for 6 hex char with twice the same char at each color: #f00 == #ff0000 == red #9ac == #99aacc ...
6th Apr 2020, 3:20 PM
visph
visph - avatar
0
I have a code which converts those values. https://code.sololearn.com/c4X4zobmnjGa/?ref=app
15th Aug 2020, 4:39 PM
S-Coder
S-Coder - avatar