Explore 100's Of Free Video Tutorials

Keep Learning, Keep Coding & Keep Sharing

Decimal Vs Hexadecimal

Notes:

HTML - Hexadecimal color value :
Every color has an equivalent hexadecimal value.

In html we can apply color to the text in two ways.
Either we can use color name from html color names list, or we can use the equivalent hexadecimal color value.
Hexadecimal number system:
In hexadecimal number system we have sixteen digits. 0 to 9 and to indicate 10,11,12,13,14,15 we use a,b,c,d,e and f characters respectively. Hexadecimal number system has base 16. Hence to get the decimal value of hexadecimal number we get the sum of each digit multiplied by 16 to the power of digit place - 1.
#symbol is prefixed by hexadecimal color value.
two digit places dedicated for red color value
two digit places dedicated for green color value
two digit places dedicated for blue color value

color names and their equivalent hexadecimal values:
#ff0000 indicates red color
#00ff00 indicates green color
#0000ff indicates blue color
#ffffff indicates white color
#000000 indicates black color
#ffff00 indicates yellow color

Interview Questions:

1. What is the hexadecimal equivalent of black color?
a. #000000
b. #ffffff
c. #black
d. #ff00ff
Answer: a