CSS memo, css memo
CSS rule illustration
Different colors
p { color: #ff0000; }p { color: rgb(255,0,0); }p { color: rgb(100%,0%,0%); }
When the RGB percentage is used, the percentage symbol must be written even if the value is 0.
Value quotation marks
If the value is a number of words, enclose the value with quotation marks.
p {font-family: "sans serif";}
Attribute Selector
It is specified only! When DOCTYPE is used, IE7 and IE8 support attribute selectors. Attribute selection is not supported in IE6 and earlier versions.
[Attribute]
Used to select elements with specified attributes.
[Attribute=Value]
Used to select elements with specified attributes and values.
[Attribute~ =Value]
Used to select elements whose attribute values contain the specified vocabulary. Applies to attribute values separated by spaces. Title = 'Hello world'
[Attribute| =Value]
Used to select an element with an attribute value starting with a specified value. The value must be the entire word. Applies to the attribute values separated. Lan = 'zh-cn'
[Attribute^ =Value]
Matches each element whose attribute value starts with a specified value.
[Attribute$ =Value]
Matches each element whose attribute values end with a specified value.
[Attribute* =Value]
The matching property value contains each element of the specified value.
Selector priority
The CSS style selector has four levels: a, B, c, and d. The priority of the CSS selector can be determined based on these four levels.
Calculate the values of a, B, c, and d for priority ranking.
Font family
- Serif font
- Sans-serif font
- Monospace font
- Cursive font
- Fantasy font
Link Style
- A: link-common, unaccessed link
- A: visited-the user's accessed Link
- A: hover-The mouse pointer is above the link
- A: active-time when the link is clicked
A: hover must be located after a: link and a: visited, and a: active must be located after a: hover.
Percentage setting for the value of the internal and external margins
Padding and margin use the percentage setting to calculate the percentage of width relative to the parent element.