Im working on a project and im using ul and li's.
I have to change background for 3 alternate li's. since list item is coming from backend I won't be knowing about number of list item.
I tried with css3 child classes but couldn't able to achieve.. Is there any way i can achieve this with css or jquery?
.list-item li
{
width:30%;
display:inline-block;
}
<ul class="list-item">
<li>list item 1</li>
<li>list item 2</li>
<li>list item 3</li>
<li>list item 4</li>
<li>list item 5</li>
<li>list item 6</li>
<li>list item 7</li>
<li>list item 8</li>
<li>list item 9</li>
</ul>
As you can see in image, Here I am using table and I am achieving this using nth-child(even)/(odd) property.because of few restrictions I can't use table here. So need to achieve this using li's.