【发布时间】:2021-09-22 14:07:35
【问题描述】:
我的 html 看起来像这样
<div id="mainDiv">
<p></p> //this can be any tag like <ul></ul> or <h1></h1>...
<ul></ul> //this can be any tag like <p></p> or <h1></h1>...
<div></div> //this too
</div>
我想将display:none 应用于#mainDiv 中的第二个元素(在本例中为<ul></ul>),以便将其隐藏。
我怎样才能实现它?
【问题讨论】:
-
查看 CSS 的 :nth-child(2) 选择器。
标签: javascript html css wordpress