我怎样才能隐藏.statistics-list
包含ul
没有 的的?li
.statistics-section {
border: 2px solid red;
}
.statistics-section:has(ul:has(:not(li))) {
display: none;
}
<div class="statistics-section">
<h2>Hello 1 - This should be visible</h2>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>
<div class="statistics-section">
<h2>Hello 2 - This should be hidden</h2>
<ul></ul>
</div>