Pseudo-Class - :nth-last-of-type()

Pattern:

:nth-last-of-type(Nth)

The argument Nth is of the following format:

  • ODD

Odd numbers, the same signification as 2n+1

  • EVEN

​​Even, the same as 2n

  • [-|+]?[0-9]+

E.g., 0, 6, +7

  • [-|+]?[0-9]+N[[-|+]?[0-9]+]?

E.g., 5n, 2n+1, -2n+1

 

Definition:

The ELEM:nth-last-of-type(Nth) pseudo-class represents every element that is the Nth child of ELEM type of its parent element, counting backward from the last child.

 

Examples:

Style every <p> element whose index is odd (2n+1), counting only <p> element type from the last one of its parent

p:nth-last-of-type(odd) { margin-left: 30px; }
w10schools
2014-11-13 08:58:35
Comments
Leave a Comment

Please login to continue.