coningham
1/27/2015 - 5:39 PM

nth-child(n)

nth-child(n)

/*usei pra adicionar/remover linhas cinzas no jornal de valinhos*/

/*The :nth-child() selector might require a bit of experimentation to fully understand.
The easiest implementation is to use the keywords odd or even, which are useful when displaying data that consists of rows or columns.*/

ul li:nth-child(odd) {
background-color: #666;
color: #fff; }

table tr:nth-child(even) { … }

/*The :nth-child selector can be much more specific and flexible, though. You could select only the third element from a list, like so:*/

li:nth-child(3) { … }

/*Note that n does not start at zero, as it might in an array. The first element is :nth-child(1), the second is :nth-child(2) and so on.*/