css| Web page
CSS can handle 16,777,216 colors, using first name, RGB value, or hexadecimal code.
Red color
Equal to
RGB (255,0,0)
Equal to
RGB (100%,0%,0%)
Equal to
#ff0000
Equal to
#f00
There are 17 predefined colors, which are:
Aqua, black, blue, fuchsia, gray, green, lime, maroon, navy,
Olive, orange, purple, red, silver, teal, white, and yellow.
Transparent is also a correct value.
RGB three values are from 0 to 255,0 is the lowest, 255 is the highest, these values can also be percentages.
We usually use 10 in 0-9, but hexadecimal uses 16, or 0 to F.
Hexadecimal three or six digit lengths are preceded with a # character, and three lengths are six compression forms, such as #f00 is ff0000 compression, #c96是 #cc9966. Three digits are well understood, like RGB, the first is red, the second is green, and the third is blue. But the six-digit number gives more color control.
Color and Background-color
Colors can be used with color and Background-color, is American English "color" is not "colour".
Blue background, yellow text:
H1 {
Color:yellow;
Background-color:blue;
}
These colors may be coarse and you can use additional chroma:
Body {
Font-size:0.8em;
Color:navy;
}
H1 {
Color: #ffc;
Background-color: #009;
}
You can see the H1 has turned yellow and blue.
Color and Background-color can be used in most HTML elements, including the body.