Child element selector
1. Select a child of the element
(1) and descendant selectors different: #choose_car option
For example #choose_car> option
footer>p
It can be a lot of class
ul>ol>li>em
Note: the direct child can use>
2. Select Group
Selecting a plurality of selected groups of elements simultaneously, separated by commas
(1) Syntax <s1>, <s2>
(2) For example: p, button
#food,.cheese
Combination
(1) Select span id for all child elements and all food p (including sub-elements of non-food)
#food>span,p
(2) Select the span id for all child elements food and all sub-elements p
#food>span,#food>p
All child elements (3) to select the id of food
#food>*
3. Select sibling
(1) Select another element immediately after the element, both have the same parent element
For example: # food + div
#many>div>p.special+p
(2) Select the element after another element, there are both the same parent element
such as
#food~div
4. attribute selector
The element may be selected attributes and attribute values of the element
such as
* [Style] # selected values of all style attributes
p [spec = len2] # value of the specified attribute
p [spec * = 'len2'] # contains the value of len2
p [spec ^ = 'len2'] # to begin len2
p [spec $ = 'len2'] # to end len2
p[class=special][name=p1]
css selector syntax Detailed URL:
http://www.w3school.com.cn/cssref/css_selectors.ASP
Common syntax:
: Nth-child (n) # number of front to back
: Nth-last-child (n) # number back to front
Automatic selection box: