Layout ds-center
Center, cover, grid
Three framing primitives: a measure-constrained column, a minimum-height region with a vertically centred principal element, and an auto-fit grid that reflows without media queries.
ds-center — constrained measure
A column stops growing at its measure and stays centred in whatever space is left, so long lines never run past a comfortable reading width.
ds-cover — centred principal element
Header
Principal — pushed to the middle by auto block margins
Footer
ds-grid — auto-fit columns
One
Two
Three
Four
Five
Six
Custom properties
Usage example
<ds-center
style="--ds-center-measure: 40ch; --ds-center-gutter: 16px"
>
<p>Readable column of text.</p>
</ds-center>
<ds-cover style="--ds-cover-min-height: 240px">
<header>Top</header>
<div class="principal">Vertically centred</div>
<footer>Bottom</footer>
</ds-cover>
<ds-grid
style="--ds-grid-min: 160px; --ds-grid-gap: 12px"
>
<article>One</article>
<article>Two</article>
</ds-grid>
API Reference
| Element | Custom property | Default | Description |
|---|---|---|---|
| ds-center | --ds-center-measure | 60ch | Maximum inline size before the column stops growing. |
| ds-center | --ds-center-gutter | --ds-spacing-md | Minimum inline padding on each side. |
| ds-cover | --ds-cover-min-height | 100vh | Minimum block size of the region. |
| ds-grid | --ds-grid-min | 250px | Minimum column width. Columns auto-fit, and a single column never overflows a narrower container. |
| ds-grid | --ds-grid-gap | --ds-spacing-md | Gap between grid items. |
Slots
| Element | Slot | Description |
|---|---|---|
| ds-cover | .principal | A slotted child with this class takes auto block margins, so it sits centred between whatever else is present. |
| ds-center / ds-grid | (default) | Content the element frames. |