The :first-of-type CSS pseudo-class represents the first sibling of its type in the list of children of its parent element.
<!DOCTYPE html> <html> <head> <style> p:first-of-type { background: #ff0000; } </style> </head> <body> <h1>first of type example</h1> <p>The first paragraph.</p> <p>The second paragraph.</p> <p>The third paragraph.</p> <p>The fourth paragraph.</p> </body> </html>