Space Between
space-y-0 through space-y-24 add a bottom margin to every child except the
last. They are the quickest way to give a stack of cards or paragraphs one gap.
Classes
Section titled “Classes”| Class pattern | Effect |
|---|---|
space-y-0 … space-y-24 |
margin-block-end on every child but the last |
<div class="space-y-3"> <p>One</p> <p>Two</p> <p>Three</p></div>space-y-* is compact-only. For a configurable gap that also works with a
container query, use the stack primitive and its --stack-gap:
<div class="stack" style="--stack-gap: var(--nc-space-4)">…</div>The utility reads --space-y:
<div class="space-y-4" style="--space-y: 0.75rem">…</div>When to use it
Section titled “When to use it”space-y-* is for prose and plain vertical lists, where the children do not
share a flex or grid parent. If they do, use Gap: the gap belongs to
the layout and does not need a rule on every child.
Do not combine space-y-* with margins on the same children; the two compete for
the same space. See Margin for the per-child tools.
Use in CSS
Section titled “Use in CSS”The class is the markup shorthand. The same style in a component stylesheet:
.stack > :not(:last-child) { margin-block-end: var(--nc-space-4);}The Sass subpackage exposes the same value: nc.nc-space(4). See Sass
subpackage.
A breakpoint is the same declaration inside a media query; you do not need a second class.