admin管理员组文章数量:1130349
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.
Share Improve this question asked Oct 29, 2018 at 17:13 p onelandp oneland 171 silver badge8 bronze badges1 Answer
Reset to default 0You can css
ul li:nth-child(n+3) {
display: none;
}
It'll not show 3rd and up.
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.
Share Improve this question asked Oct 29, 2018 at 17:13 p onelandp oneland 171 silver badge8 bronze badges1 Answer
Reset to default 0You can css
ul li:nth-child(n+3) {
display: none;
}
It'll not show 3rd and up.
本文标签: theme developmentHow to display only the first two elements from ten same elements
版权声明:本文标题:theme development - How to display only the first two elements from ten same elements 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749223531a2335328.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论