Home › Forums › CSS › CSS selector for parent with blank element › Reply To: CSS selector for parent with blank element
November 20, 2017 at 4:13 am
#262799
Paulie_D
Member
Is there any other HTML/CSS workaround to hide
<li>
elements with an empty<p>
? maybe with data selectors?
AS Beverley said, you need to be able to specifically identify the li
that have an empty p
.
How you do that is up to you, whether by applying a class or data-attribute is up to you but it will have to be hard-coded in the HTML.
For instance:
<li id="size1" class="size">
<p>Queen</p>
<p>80" x 90"</p>
</li>
<li id="size2" class="size has-empty-p">
<p>King</p>
<p></p> <!-- N/A -->
</li>