HTML Colors

A hex triplet is a six-digit, three-byte hexadecimal number used in HTML and other computing applications to represent colors. One byte represents a number in the range 00 to FF (in hexadecimal notation), or 0 to 255 in decimal notation. In HTML, a color can be specified by using a color name.

EXAMPLE

Tomato
Orange
DodgerBlue
MediumSeaGreen

 

Background Color

You can set the background color for HTML elements.

Example

<h1 style=”background-color:DodgerBlue;”>Hello World</h1>
<p style=”background-color:Tomato;”>Lorem ipsum…</p>

Text Color

It can also set the color of text.

Example

<h1 style=”color:Tomato;”>Hello World</h1>
<p style=”color:DodgerBlue;”>Lorem ipsum…</p>

Border Color

You can set the color of borders such as.
Hello World

Example

<h1 style=”border:2px solid Tomato;”>Hello World</h1>
<h1 style=”border:2px solid Violet;”>Hello World</h1>

RGB Value

The RGB color system constructs all the colors from the combination of the Red, Green and Blue colors. The red, green and blue use 8 bits each, which have integer values from 0 to 255. This makes 16777216 possible colors.

Example

rgb(0, 0, 0) rgb(60, 60, 60)
rgb(120, 120, 120) rgb(180, 180, 180)
rgb(240, 240, 240) rgb(255, 255, 255)