Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
/* Select every 2nd paragraph, ignoring other elements */ p:nth-of-type(even) { color: #666; } /* Select 1st image, even if it is not the 1st child */ img:nth-of-type(1) { float: left; } /* Compare: nth-child counts ALL siblings */ /* nth-of-type counts only matching tag siblings */ p:nth-child(2) { ... } /* 2nd child, only if it is a <p> */ p:nth-of-type(2) { ... } /* 2nd <p> regardless of position */
Result
Open