html5 - Use nth child in CSS3 -
i select each group of 3 elements first one
example :
<ul> <li>1</li> <!-- 1 --> <li>2</li> <!-- 1 --> <li>3</li> <!-- 1 --> <li>4</li> <li>5</li> <li>6</li> <li>7</li> <!-- 1 --> <li>8</li> <!-- 1 --> <li>9</li> <!-- 1 --> <li>10</li> </ul> so have add background 1 1, 2, 3; 7, 8, 9; 13, 14, 15, etc .. don't have total amount of <li>
is there solution using nth-child() ?
yes, there solution using nth-child obviously.
li:nth-child(6n+1), li:nth-child(6n+2), li:nth-child(6n+3){ color: blue; background-color: red; } basicly 'nth-child' making kind of formula you. replace 'n' number check children work.
Comments
Post a Comment