HTML colors can be specified using the following methods:
Each method has its own syntax and can be used to define colors in HTML and CSS.
Below is a reference table for each method, including examples and descriptions.
Syntax | Notation Name | Description | |
---|---|---|---|
color: #ff0000 | Hex Notation | Produces the color Red | |
color: #00ff00 | Hex Notation | Produces the color Green | |
color: #0000ff | Hex Notation | Produces the color Blue | |
Hexadecimal notation is a way to represent colors using a combination of numbers and letters. It is commonly used in web design and development. |
Syntax | Notation Name | Description | |
---|---|---|---|
hsl(0 or 360, 100%, 50%) | Hue Saturation Notation | Produces the color Red | |
hsl(120, 100%, 50%) | Hue Saturation Notation | Produces the color Green | |
hsl(240, 100%, 50%) | Hue Saturation Notation | Produces the color Blue | |
HSL notation is a way to represent colors using hue, saturation, and lightness values. It is commonly used in web design and development. |
Syntax | Notation Name | Description | |
---|---|---|---|
rgb(255,0,0) | Rgb Notation | Produces the color Red | |
rgb(0,255,0) | Rgb Notation | Produces the color Green | |
rgb(0,0,255) | Rgb Notation | Produces the color Blue | |
RGB notation is a way to represent colors using red, green, and blue values. It is commonly used in web design and development. |
Syntax | Notation Name | Description | |
---|---|---|---|
color: red | Color Name Notaton | Produces the color Red | |
color: green | Color Name Notation | Produces the color Green | |
color: blue | Color Name Notation | Produces the color Blue | |
Color names are predefined names for colors in HTML and CSS. They are easy to use and widely supported. |
Syntax | Notation Name | Description | |
---|---|---|---|
color: hwb(360 or 0, 0%, 0%) | Hwb Notaton | Produces the color Red | |
color: hwb(120, 0%, 0%) | Hwb Notaton | Produces the color Green | |
color: hwb(240, 0%, 0%) | Hwb Notaton | Produces the color Blue | |
HWB notation is a way to represent colors using hue, whiteness, and blackness values. It is commonly used in web design and development. |