Skip to content
Nate
Stephens

Child Selector as an Arbitrary Modifier

This arbitrary modifier selects all p elements within the element where you’ve added the class:

<div class="[&_p]:mt-4">
  <p>Lorem ipsum...</p>
  <ul>
    <li>
      <p>Lorem ipsum...</p>
    </li>
    <!-- ... -->
  </ul>
</div>

Last Updated: