Updated on Kisan Patel
The background-color
property sets the background of the HTML element.
Syntax
background-color: red;
background-color: rgb(255, 255, 128);
background-color: #bbff00;
background-color: inherit;
Example
h1 { background-color:yellow; }
You can also specify transparent background by setting the value of background-color property as transparent.
h1 { background-color: transparent; }
There are three groups of colors. Those are as given below –
This is the smallest group of colors. In this group there are 16 colors. These are named colors. The colors in this group are enlisted as follows–
Sr. no. | Color name | Hexadecimal value |
---|---|---|
1 | Black | 000000 |
2 | Red | FF0000 |
3 | Lime | 00FF00 |
4 | Blue | 0000FF |
5 | Yellow | FFFF00 |
6 | Fuchsia | FF00FF |
7 | Aqua | 00FFFF |
8 | White | FFFFFF |
9 | Silver | C0C0C0 |
10 | Gray | 808080 |
11 | Maroon | 800000 |
12 | Purple | 800080 |
13 | Green | 008000 |
14 | Olive | 808000 |
15 | Navy | 000080 |
16 | Teal | 008080 |