Browse documentation

Reference / Spacing

Space between children

Apply a consistent inline or block margin to the direct siblings after the first visible child in a stack or row.

Working example

This pattern suits a single stack. Gap also handles the spacing between lines when flex items wrap.

HTML
<ol class="space-y-3">
  <li class="border-b pb-1">Check the folios</li>
  <li class="border-b pb-1">Trim the sheets</li>
  <li class="border-b pb-1">Bind the book</li>
</ol>

Class reference

ClassCSS declarations
space-x-2margin-inline-start: 0.5rem;
space-x-4margin-inline-start: 1rem;
space-y-2margin-block-start: 0.5rem;
space-y-4margin-block-start: 1rem;
-space-x-2margin-inline-start: -0.5rem;
View full generated CSS
Compiled CSS
.-space-x-2 > :where(:not([hidden]) ~ :not([hidden])) {
  margin-inline-start: -0.5rem;
}
.space-x-2 > :where(:not([hidden]) ~ :not([hidden])) {
  margin-inline-start: 0.5rem;
}
.space-x-4 > :where(:not([hidden]) ~ :not([hidden])) {
  margin-inline-start: 1rem;
}
.space-y-2 > :where(:not([hidden]) ~ :not([hidden])) {
  margin-block-start: 0.5rem;
}
.space-y-4 > :where(:not([hidden]) ~ :not([hidden])) {
  margin-block-start: 1rem;
}