HTML
CSS
PHP
Deno
Examples
Do It Yourself
Blog
Type in your code below
Run
<!DOCTYPE html> <html> <head> <style> p:nth-child(even) { color: green; } </style> </head> <body> <div> <p>I am child one</p> <p>I am child two</p> <p>I am child three</p> <p>I am child four</p> </div> <h3> The example below changes the color of the second and fourth elements which are having even positions (two and four) to "green". </h3> </body> </html>
Related Chapters
CSS Pseudo-Classes Selectors
CSS Positions
CSS Grouping
CSS Selectors
Related Examples
HTML CSS Tag Name Selector Description
CSS Pseudo Class :nth-child()
CSS Links pseudo last Child
CSS Selectors Grouping Intro
CSS Links Pseudo Class