HTML Tutorial
HTML Forms
HTML Graphics
HTML Media
HTML API
Html Colors
Color Names
In HTML, any color can be defined by using a color name:
Example:
Tomato
Orange
DodgerBlue
MediumSeaGreen
Gray
SlateBlue
Output:

Text Colors
The color of the text can be set as:
Example:
Hello World
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
Output:
Hello World
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
Border Colors
The color of the borders can be set as:
Example:
Hello World
Hello World
Hello World
Output:
Hello World
Hello World
Hello World
Color Values
In HTML, colors can also be used in the form of RGB values, HEX values, HSL values, RGBA values, and HSLA values.
The below three <div> elements have their background color set with RGB, HEX, and HSL values:
Example:
Same as color name "Tomato":
rgb(255, 99, 71)
#ff6347
hsl(9, 100%, 64%)
Same as color name "Tomato", but 50% transparent:
rgba(255, 99, 71, 0.5)
hsla(9, 100%, 64%, 0.5)
In addition to the predefined color names, colors can be specified using RGB, HEX, HSL, or even transparent colors using RGBA or HSLA color values.
Output:
Same as color name “Tomato”:
rgb(255, 99, 71)
#ff6347
hsl(9, 100%, 64%)
Same as color name “Tomato”, but 50% transparent:
rgba(255, 99, 71, 0.5)
hsla(9, 100%, 64%, 0.5)
In addition to the predefined color names, colors can be specified using RGB, HEX, HSL, or even transparent colors using RGBA or HSLA color values.