HTML HEX Colors Examples
Example 1: In this example, we will print the different hex color codes by using the background color style in the HTML heading tag.
HTML
<!DOCTYPE html> < html > < head > < title >HTML Hex Color Codes</ title > </ head > < body > < h1 >Welcome To w3wiki</ h1 > < h2 style = "background-color:#808000;" >#808000</ h2 > < h2 style = "background-color:#CD5C5C;" >#CD5C5C</ h2 > < h2 style = "background-color:#FFA07A;" >#FFA07A</ h2 > < h2 style = "background-color:#DC143C;" >#DC143C</ h2 > </ body > </ html > |
Output:
Example 2: In this example, we will print the different hex color by manipulating hex code in the HTML heading tag.
HTML
<!DOCTYPE html> < html > < head > < title >HTML Hex Color Codes Examples</ title > </ head > < body > < h1 >Welcome To w3wiki</ h1 > < h2 style = "background-color:#FF0000;" >#FF0000</ h2 > < h2 style = "background-color:#00FF00;" >#00FF00</ h2 > < h2 style = "background-color:#0000FF;" >#0000FF</ h2 > < h2 style = "background-color:#FFFF00;" >#FFFF00</ h2 > < h2 style = "background-color:#CCEEFF;" >#CCEEFF</ h2 > </ body > </ html > |
Output:
#FF0000 – This HTML color code shows just red and no green and no blue.
#00FF00 – This HTML color code shows just green and no red and blue.
#0000FF – This HTML color code shows just blue and no red and green.
#FFFF00 – This HTML color code is a mixture of red and green colors defined as yellow.
#CCEEFF – This HTML color code is a mixture of more green and maximum blue provides color like the sky.
Example 3: In this example we will see some hex color color code for the shades of red color with an example.
HTML
<!DOCTYPE html> < html > < head > < title >Shades of Red Colors</ title > </ head > < body > < h1 >Welcome To w3wiki</ h1 > < h2 style = "background-color:#FFA07A;" >#FFA07A</ h2 > < h2 style = "background-color:#FA8072;" >#FA8072</ h2 > < h2 style = "background-color:#FF0000;" >#FF0000</ h2 > < h2 style = "background-color:#8B0000;" >#8B0000</ h2 > </ body > </ html > |
Output:
HTML Hex Color Codes
HTML Hex Color Codes consist of a hash (#) symbol followed by six characters, representing the intensity of red, green, and blue (RGB) in hexadecimal format.
For instance, #RRGGBB, where each pair of characters denotes the RGB values. These codes are widely used to define colors in HTML and CSS.
There are 1,67,77,216 different color possibilities. 00 value range of the code represents the lowest intensity of color on the other hand FF value range of the code represents the highest intensity.
Contact Us