background preloader

Webdesigner / coder

Facebook Twitter

How To Use CSS :nth-child. There is a CSS selector which allows you to select the exactly item that you want from a list. This selector is the :nth-child selector, in this tutorial you will learn what you can do with the :nth-child and how it can be helpful. Below is a list which has 10 list items in it, we are going to use :nth-child, :first-child and :last-child to select the items we want to highlight. Use CSS :nth-child To Select Exact Item By passing a number to the nth-child function you can define which child to return from the selector group. Item 1Item 2Item 3Item 4Item 5Item 6Item 7Item 8Item 9Item 10 Use CSS :nth-child To Select All But the First 5 Items By passing in a n+ number into the nth-child selector you can make it pick all elements from this number. Use CSS :nth-child To Select Only First 5 Items By passing in a negative n+ a number you make it return all element before this number.

Use CSS :nth-child To Select Every 3rd Item Use CSS :nth-child To Select Only Odd Items nth-child Tester. Teehan+Lax | Interactive user experience design. Dustin Curtis is a superhero. Mike Shelton // Web Designer & Developer. David DeSandro.