Class example. Box Selects all elements of class=”box”

2 id selector #id example #box Selects the element whose ID =”box”

3 Wildcard selector * example * Selects all elements

4 Label selector div Example div selects all divs

Div,span select all div and span div span select all spans within div div>span select all spans whose parent is div div+ SPAN select the span element immediately following div div~span Select each span element after divCopy the code

5 Attribute selector [target] Example [SRC] Selects all elements with [SRC]

[target = "black"] to select all use [target = "black"] elements/target ~ = "black" select all target attribute contains the elements of black (black aaa) [target | = "black"] Select all elements whose target attribute starts with black (black-aaa) [target^="bla"] Select all elements whose target attribute starts with black (blackAAA) [target$="ack"] Select all elements whose target attribute begins with ack (black) [target*="la"] Select all elements whose target attribute begins with la (la)Copy the code

6 a label

A :link unvisited style A: Visited visited style A :hover styleCopy the code

7 the input tag

Input :focus The appearance of the focusCopy the code

8

P :before Insert content after each P tag P: After insert content before each P tag P :first-letter First letter of each P tag P :first-line First line of each P tag p:first-child first child of each P tag P :lang(it) Selects all p elements starting with the lang attribute value "it"Copy the code