CSS selector syntax
CSS stylesheets are composed of selectors and life blocks. The declaration block has a property name, a property value, a colon separated by the middle, and a semicolon ending.
Selector Group actions
You can combine several selectors into a piece to quickly select the elements of the operation. For example, h1,h2,h3,h4,h5,h6{color:red;}
* Wildcard selector, select all the elements.
Tag Selector class Selector
Consists of a dot plus a name. The HTML tag is required to add the class attribute.
The class can be used in conjunction with the tag selector: P.class1.
Two classes can be used in the. Class1.class2 mode, select Class= "Class1 class2".
ID Selector
#加名字.
There is a limit, an element can have only one ID.
The ID selector is larger than the weight of the class.
Property Selector
The Class,id selector is a special case of the property selector.
[Attribute]
[attribute= "Value"]
[attribute~= "Value"]
[attribute^= "Value"]
[attribute$= "Value"]
[attribute*= "Value"]
[attribute|= "Value"]
Descendant Selector
H span
H>span
H+p
Pseudo class
Some state of the element
The status of a link link,visitied
Dynamic pseudo-class for all elements: Active,focus,hover
Static Pseudo-Class: First-children
Pseudo element
Creates a virtual element
: First-letter
: First-line
: After,:before
CSS Selector (CSS Ultimate guide reading review)