CSS encoding is essential for color control. Not many of them are involved. But this is the basic knowledge. New friends need to know something, and the veterans can ignore it.
Theoretically, the number of colors that CSS can process is about 16,777,216. Enough. How can we express these colors in three forms:
1. Name: blue
2. RGB, for example, 255, 0, and 0
3. Hexadecimal format: # ff6600
If we want to set the red color, it can be in the following format:
Name: red
RGB: rgb (255, 0, 0)
RGB: rgb (100%, 0%, 0%)
Hexadecimal: # ff0000
Hexadecimal: # f00
For detailed development, you can refer to the following files:
As shown in the following figure:
CSS has 17 predefined colors, which are:
Aqua, black, blue, fuchsia, gray,
Green, lime, maroon, navy, olive,
Orange, purple, red, silver,
Teal, white, yellow.
(Note: transparent transparency is also a correct value .)
The three values of rgb are from 0 to 255, which is the lowest level and is the highest level. These values can also be percentages.
In hexadecimal notation, three or six digits are preceded by # Characters, and the three are six compression formats. For example, # 00f is # 0000ff compression, and # c30 is # cc3300. Three digits are easy to understand, such as rgb. The first is red, the second is green, and the third is blue. However, more color control can be achieved by six digits.