0

I need to apply a bunch of css properties only to a ul item which has a child of li.example-class, and not to every other ul.

Example:

<ul>   <!-- this one has the css applied to it -->
  <li class="example-class">...</li>
  <li class="example-class">...</li>
  <li class="example-class">...</li>
</ul>   
<ul>   <!-- and this one has no css applied -->
  <li class="not-example-class">...</li>
  <li class="not-example-class">...</li>
  <li class="not-example-class">...</li>
</ul>
joker876
  • 25
  • 1
  • 4
  • I wish the :has pseudo class selector quickly gets past the "WD" flag in the spec [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/:has). But it's not passed yet, and will be a while before it makes it to browsers. An alternative would be [Another Stackoverflow Answer](https://stackoverflow.com/questions/2326499/apply-css-styles-to-an-element-depending-on-its-child-elements#:~:text=You%20may%20want%20to%20consider,parent%20all%20in%20one%20line.&text=Here's%20the%20documentation%20for%20the%20jQuery%20%22has%22%20selector.) – Rishabh Anand Oct 20 '20 at 12:52

0 Answers0