nth-of-type (:nth-of-type)
The :nth-of-type CSS pseudo-class matches an element that has an+b-1 siblings with the same element name before it in the document tree, for a given positive or zero value for n, and has a parent element.
Example
<!DOCTYPE html> <html> <head> <style> p:nth-of-type(2n+1) { text-align: left; } p:nth-of-type(2n) { text-align: right; } </style> </head> <body> <div> <p>First paragraph (left aligned)</p> <p>Second paragraph (right aligned)</p> <p>Third paragraph (left aligned)</p> </div> </body> </html>