Layout Primitives
NightCSS provides native CSS Grid and flex-based layout primitives. Most use
gap, flex-wrap, and min()/clamp(), so they adapt without media queries.
container
Section titled “container”A centered, width-capped wrapper with responsive gutters. The min() pattern
means no media queries.
<div class="container">…</div>This text sits inside a centered, capped container.
Native CSS Grid with grid-cols-* (equal columns, 1–24) and col-span-*.
<div class="grid grid-cols-3 gap-4"> <div>One</div> <div>Two</div> <div class="col-span-2">Spans two</div></div>There is no grid-cols-md-* variant. For responsive columns, write the media or
container query in your CSS — see Grid for 12-column pages,
auto-fitting card grids, dashboards, and container queries.
A vertical flow with a consistent gap between every child.
<div class="stack"> <div>One</div> <div>Two</div> <div>Three</div></div>The gap is --nc-space-4 by default and overridable per-instance:
<div class="stack" style="--stack-gap: 2rem">…</div>cluster
Section titled “cluster”A wrapping group of items with a consistent gap. Items flow inline and wrap when they run out of room — ideal for tags, toolbars, and button groups.
<div class="cluster"> <span>alpha</span> <span>beta</span> <span>gamma</span></div>sidebar
Section titled “sidebar”A two-column split that collapses to one column when there isn’t room. The first child is the sidebar, the last child is the content, which grows to fill the rest.
<div class="sidebar"> <aside>Sidebar</aside> <main>Content that grows</main></div>The sidebar width and gap are overridable:
<div class="sidebar" style="--sidebar-width: 20rem; --sidebar-gap: 2rem">…</div>switcher
Section titled “switcher”Lays children in a row when there is room and stacks them when the container is
narrower than a threshold — no media query, just a flex-basis calc that flips
sign around the threshold.
<div class="switcher"> <div>Left</div> <div>Right</div></div><div class="switcher" style="--switcher-threshold: 30rem">…</div>A full-height stack that pins the first child to the top, the last child to the bottom, and centers everything between. A single child is centered on its own.
<div class="cover"> <header>Top</header> <p>Centered</p> <footer>Bottom</footer></div>Crops media (or any child) to a fixed aspect ratio.
<div class="frame" style="--frame-ratio: 16 / 9"> <img src="…" alt="…" /></div>The ratio is 16 / 9 by default and overridable with --frame-ratio.