Home  >  Article  >  Java  >  Summarize the points to note about nth-of-type

Summarize the points to note about nth-of-type

巴扎黑
巴扎黑Original
2017-06-13 11:38:401800browse

The difference between nth-child and nth-of-type in CSS3 is actually very simple: Why is :nth-of-type called :nth-of-type? Because it is distinguished by "type". That is to say: ele:nth-of-type(n) refers to the nth ele element under the parent element, and ele:nth-child(n) refers to the nth element under the parent element and this element is ele. If If not, the selection fails. The text may sound rather obscure, but it is easier to understand. Here is a small example: demo