CSS Color Properties
Specifies the color of the text in CSS using the color attribute.
The default value is not specified has inheritance, in JavaScript The syntax is object. style.color= "#FF0000"
Method of taking value
1, English word color:name; Specifies the color value for the color name.
But the English words can express the color is limited, not all the colors have English names, like all the colors will not have the same text.
2,rgb (red, green, blue)
RGB format, Format RGB (0,0,0);
RGB format, is actually three primary colors, R (red) g (green) B (Blue blue)
The primary color will match all the colors, the first number in the format represents the red display brightness, the second represents the green color rendering brightness, the third represents the blue display brightness. Their values range from 0-255, 0 for non-luminous, 255 for glow, and the larger the brighter the higher the value.
Red: rgb (255,0,0)
Green: rgb (0,255,0)
Blue: rgb (0,0,255)
Black: rgb (0,0,0)
White: rgb (255,255,255)
Three values the smaller the more black, the larger the more white, three the same time is gray, the value size determines the brightness.
There is also Rgba, where a is for transparency, the value range is 0-1, the smaller the value the more transparent, in the CSS opacity can also set the transparency, then what is the difference between them?
The difference is that when you want to display other elements on a transparent background, opacity makes the elements transparent, and RGBA does not.
3, hexadecimal representation of color, format: color: #ffcc00 (for example);
Hexadecimal method, the essence is RGB, each two bits represents a color, such as above, FF means that r,cc means g,00 represents B.
We all know 10 into the system, that is, every 10 into 1, hexadecimal is every 16 into 1,
The corresponding numeric conversion to get the corresponding color, the other is that when no two people the same time we can be abbreviated, as an example we can write: color: #fc0;
4,HSL Color
IE9, Firefox, Chrome, Safari, and Opera. Supports HSL color values.
HSL (hue hue, saturation saturation, lightness lightness).
Hue is the degree of color on the wheel (from 0 to 360)-0 (or 360) is red, 120 is green, and 240 is blue.
Saturation is a percent value; 0% means gray and 100% shades, which are full color.
The brightness is also 1%, 0% is black, and 100% is white.
HSL is more in line with human intuition, such as a person's general expression of a color would say: a little thick dark red. Not to say how much red, green accounted for how much, blue accounted for.
The rag is suitable for machine recognition of color.
Where would you use the color?
briefly summarize
First text color, text and text underline color Text-decoration-color,
Next is the box model border Border-color (the color of the border can be set individually in each direction border-left-color,border-right-color,border-top-color, Border-bottom-color) and background color background-color.
A tag mouse floats, clicks, not accessed, has been accessed when the font color and background color.
The text background color of the table, and the border color of the table.
Contour Outline-color ().
CSS color properties and places to set colors