Different Colors in HTML
Overview
In HTML language, we can specify colors in different ways. HTML supports a predefined set of named colors, such as “red”, “blue”, “green”, etc. These are easy to remember and use.
Different Colors in HTML
Some colors that we can use in HTML are as follows:
Named Colors
We can directly use the defined color names in HTML code. An example to show red color paragraph text is as follows:
<p style=”color: red;”>This text is red.</p>
This text is red.
Hexadecimal Colors
Colors can also be specified using hexadecimal (hex) code, which starts with a hash symbol (#) followed by six digits. The digits represent the red, green, and blue levels in the color, respectively.
<p style=”color: #ff0000;”>This text is also red.</p>
This text is also red.
Color | Hex code |
Description |
Aqua | #00fffff |
Aqua color |
Black | #000000 |
Black color |
Blue | #0000ff |
Blue color |
Green | #008000 |
Green color |
Red | #ff0000 |
Red color |
Purple | #800080 |
Purple color |
RGB Colors
RGB stands for Red, Green, and Blue. Colors can be defined by specifying the intensity of these three primary colors using the rgb() function. Each value can range from 0 to 255.
For example:
<p style=”color: rgb(255, 0, 0);”>This is red color text using RGB().</p>
—
HTML Tutorials
HTML Tutorials on this website: