Browse documentation

Reference / Variants & accessibility

Child and descendant selectors

Style direct children with * or all descendants with **. An arbitrary selector can target a particular element within component markup.

Working example

The ampersand stands for the element carrying the class. An underscore in an arbitrary selector becomes a space, so [&_strong] reaches nested strong elements.

HTML
<ul class="border px-3 *:py-2 [&_strong]:underline">
  <li><strong>Fold</strong> the signature.</li>
  <li><strong>Press</strong> the seam.</li>
</ul>

Class reference

ClassCSS declarations
*:p-2padding: 0.5rem;
**:font-sansfont-family: ui-sans-serif, system-ui, sans-serif;
[&_strong]:underlinetext-decoration-line: underline;
[&>li]:border-bborder-bottom-width: 1px;
View full generated CSS
Compiled CSS
.\*\*\:font-sans * {
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.\*\:p-2 > * {
  padding: 0.5rem;
}
.\[\&_strong\]\:underline strong {
  text-decoration-line: underline;
}
.\[\&\>li\]\:border-b>li {
  border-bottom-width: 1px;
}