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
Grammar:
p{color:red;}
2. RGB color
This is consistent with the RGB colors in Photoshop and is matched by the ratio of R (red), G (green), 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%.
每一项的值可以是 0~255 之间的整数,也可以是 0%~100% 的百分数。
3. Hex Color
This method of color setting is now more commonly used, the principle is also the RGB setting, but the value of each item is changed from 0-255 to Hex 00-ff
p{color:#00ffff;}
Color Table Length ValuesLength 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.
Grammar:
p{font-size:12px;text-indent:2em;}
The code implements the distance from the first line of the paragraph indented 24px (12PX*2), which is two font size
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.
<p>以这个<span>例子</span>为例。</p>
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
Grammar:
p{font-size:12px;line-height:130%}
Set line height (line spacing) to 130% of the font (* 1.3 = 15.6px)
From for notes (Wiz)
HTML+CSS Notes CSS Intermediate color & length values