For example, in my theme, I have the following elements,
<ul>
<li> apple </li>
<li> orange </li>
<li> banana </li>
<li> pear </li>
<li> peach </li>
...
</ul>
I just want to display the first two li elements, how to hide the other ones form the third element?
The given condition to my issue is that, I cannot add any attribute like id or class to li elements.
For example, in my theme, I have the following elements,
<ul>
<li> apple </li>
<li> orange </li>
<li> banana </li>
<li> pear </li>
<li> peach </li>
...
</ul>
I just want to display the first two li elements, how to hide the other ones form the third element?
The given condition to my issue is that, I cannot add any attribute like id or class to li elements.
You can css
ul li:nth-child(n+3) {
display: none;
}
It'll not show 3rd and up.