Color values
The color settings in a Web page are very important, with font color (color), background color (background-color), border color (border), and so on, there are many ways to set colors:
1, English command color
The Setup method is often used in the previous sections:
p{color:red;}
2. RGB Color
This is consistent with the RGB colors in Photoshop and is color-matched by the proportions of R (red), G (green), and B (blue) Three colors.
P{color:rgb (133,45,200);}
The value of each item can be an integer between 0~255, or it can be a percentage of 0%~100%. Such as:
P{color:rgb (20%,33%,25%);}
3. Hex Color
This color setting method is now more commonly used method, the principle is also RGB settings, but its value of each item from 0-255 to hexadecimal 00-ff.
P{color: #00ffff;}
Color table:
Length value
Length unit summary, at present more commonly used to px (pixels), EM,% percent, you should pay attention to the fact that these three units are relative units.
1, Pixel
Why are pixels relative units? Because pixels refer to dots on the display (the CSS specification assumes "90 pixels = 1 inches"). The reality is that the browser uses the actual pixel value of the display, and most designers now tend to use pixels (px) as units.
2, EM
is the font-size value of the given font for this element, 1em = 14px If the element's font-size is 14px, and 1em = 18px If the font-size is 18px. The following code:
P{font-size:12px;text-indent:2em;}
The code above is the ability to indent the first line of a paragraph by 24px (that is, the distance of two font sizes).
A special case is noted below:
However, when Font-size is set to EM, the criteria for this calculation are based on the font-size of the parent element of P. The following code:
Html:
< P > Take this <span> example </span> as an example. </ P >
Css:
P{font-size:14px}span{font-size:0.8em;}
As a result, the font "example" font size in span is 11.2px (0.8 = 11.2px).
3. Percentage
p{font-size:12px;line-height:130%}
Set the line height (line spacing) to the font's 130% (* 1.3 = 15.6px).
Web Front end--html Base note no.14{color value, length value}