Single Child — Both Axes
Set a height on the container and the child is perfectly centered.
<div class="wf-center">
<div>Centered</div>
</div>
wf-center uses place-items: center on a CSS grid to center content both horizontally and vertically in a single declaration. The container must have a defined height for vertical centering to take effect — without it the grid collapses to content height and there is nothing to center against.
Set a height on the container and the child is perfectly centered.
<div class="wf-center">
<div>Centered</div>
</div>
With multiple children, the grid stacks them in a single column, centering each one horizontally. Vertical centering applies to the entire track.
<div class="wf-center">
<div>Item A</div>
<div>Item B</div>
<div>Item C</div>
</div>
Children align to the top while remaining horizontally centered.
<div class="wf-center wf-items-start">
<div>Top · Center</div>
</div>
Children align to the bottom while remaining horizontally centered.
<div class="wf-center wf-items-end">
<div>Bottom · Center</div>
</div>
Use wf-justify-self-* on a child to pull it to the start or end of the row while others remain centered.
<div class="wf-center">
<div class="wf-justify-self-start">start</div>
<div>centered</div>
<div class="wf-justify-self-end">end</div>
</div>
All modifier classes available on .wf-center
| Class Name | Type | Description |
|---|---|---|
| wf-center | Base | CSS grid with place-items: center . Centers all children both axes. Container needs explicit height for vertical centering. |
| wf-items-start / -end / -stretch | Alignment | Overrides vertical alignment of all children. |
| wf-justify-self-start / -center / -end / -stretch | Self | Overrides horizontal alignment for a single child item. |