Sizing
Sizing utilities come in two numeric scales. Steps 0 through 24 use the 4px
spacing scale, exactly like padding. Steps 25, 50, 75, and 100 are
percentages. The two ranges meet at 24 and 25, so read the number carefully:
w-24 is six rems, w-25 is a quarter of the parent.
Fixed steps
Section titled “Fixed steps”| Class pattern | Property |
|---|---|
w-0 … w-24 |
inline-size on the 4px scale |
h-0 … h-24 |
block-size on the 4px scale |
<div class="w-24">Six rems wide</div><div class="h-16">Four rems tall</div>Compact keywords:
| Class | Value |
|---|---|
w-auto, h-auto |
auto |
w-full, h-full |
100% |
w-screen |
100vw |
h-screen |
100dvh |
w-min, h-min |
min-content |
w-max, h-max |
max-content |
w-fit, h-fit |
fit-content |
Percentages
Section titled “Percentages”| Class pattern | Value |
|---|---|
w-25, w-50, w-75, w-100 |
25% … 100% of the parent |
h-25, h-50, h-75, h-100 |
25% … 100% of the parent |
max-w-*, min-w-*, max-h-*, min-h-* |
Same four steps, as constraints |
<div class="w-50">Half the parent</div><div class="min-h-100">At least the parent's height</div>Viewport units
Section titled “Viewport units”| Class pattern | Value |
|---|---|
vw-25 … vw-100 |
Viewport width |
vh-25 … vh-100 |
Viewport height |
max-vw-*, min-vw-* |
Viewport-width constraints |
max-vh-*, min-vh-* |
Viewport-height constraints |
<section class="min-h-100">Full-height section</section><div class="max-vw-75">Never wider than three quarters of the viewport</div>Constraints
Section titled “Constraints”| Class | Value |
|---|---|
min-w-0, min-h-0 |
0 |
min-w-full, min-h-full |
100% |
min-w-min, min-w-max, min-w-fit |
Content keywords |
min-h-screen |
100dvh |
min-w-auto, min-h-auto |
auto |
max-w-none |
none |
max-w-full, max-w-min, max-w-max, max-w-fit |
Keywords |
max-w-prose |
65ch |
max-w-prose is the readable-measure helper: it caps a block at 65 characters,
which is the right default for articles.
<article class="max-w-prose mx-auto">…</article>Each family has its own property:
| Family | Knob |
|---|---|
w-*, vw-* |
--w |
h-*, vh-* |
--h |
min-w-*, min-vw-* |
--min-w |
max-w-*, max-vw-* |
--max-w |
min-h-*, min-vh-* |
--min-h |
max-h-*, max-vh-* |
--max-h |
<div class="w-50" style="--w: 42ch">One-off width</div>The compact keywords (w-full, h-screen, max-w-prose, …) do not read a knob;
they set the value directly.
Responsive sizing
Section titled “Responsive sizing”These classes are in the separate responsive module: import
nightcss/utilities/responsive after the base bundle, or use
nightcss/full.
Percentage and viewport classes accept breakpoint suffixes. The breakpoint goes after the prefix:
<div class="w-100 w-md-50 w-lg-25">Full width, then half, then a quarter</div><div class="min-h-50 min-h-lg-100">Grows to full height on a laptop</div>min-w-auto and min-h-auto also have responsive forms. Fixed 4px steps and the
compact keywords are base-only.
Use in CSS
Section titled “Use in CSS”The class is the markup shorthand. The same style in a component stylesheet:
.hero { inline-size: 100%; min-block-size: var(--nc-space-24);}.avatar { inline-size: 2.5rem; block-size: 2.5rem;}The Sass subpackage exposes the same value: nc.nc-space(24). The fixed 4px
steps map to the spacing accessor; percentage and viewport keywords stay
literal. See Sass subpackage.
A breakpoint is the same declaration inside a media query; you do not need a second class.