Sub-element filter selectors are not often used, its filtering rules than other selectors slightly more complex point, in fact, Bo master feeling is not very difficult, because the word so easy, haha.
Let's see what we have here:
Note :
1.: First matches only one individual element, but: the First-child selector can match multiple: that is, each parent element is matched to the primary child element. This is equivalent to: nth-child (1)
2.:last matches only a single element: The Last-child selector can match multiple elements: that is, the last child element is matched for each parent element
3. If the child element has only one word: First-child and: Last-child is the same
4.: Only-child matches an element that is the only child element in the parent element, meaning that the current child element is the only element in the parent element, the match
5.jQuery implementation: Nth-child (n) is strictly from the CSS specification, so the N value is "index", that is, starting from 1 to Count -child (index) starting from 1, and the EQ (index) is starting from 0
The difference between 6.nth-child (n) and: Nth-last-child (n) is calculated from the previous, and the latter is from the back forward.
<! DOCTYPE html>
The
example is here to make a good experience of yo.