layout-center
Horizontally centered content container with configurable max-width. Essential for constraining content width on wide screens.
Attributes
| Attribute | Values | Default | Description |
|---|---|---|---|
data-layout-max |
narrow, normal, wide |
normal |
Maximum width (45rem, 60rem, 80rem) |
data-layout-intrinsic |
boolean | - | Centers content that is narrower than max-width |
data-layout-text |
boolean | - | Centers text alignment |
data-layout-gutter |
none, s, l |
m |
Horizontal padding (gutter) |
Max Width Variants
The data-layout-max attribute controls the maximum width of the container.
data-layout-max="narrow" (45rem) - Ideal for reading content
This content is constrained to a narrow width, perfect for long-form reading where line length matters for readability.
data-layout-max="normal" (60rem) - Default, balanced width
Normal width provides a good balance for most content types including text, forms, and mixed layouts.
data-layout-max="wide" (80rem) - For dashboards and data-heavy layouts
Wide containers work well for dashboards, data tables, and layouts that benefit from more horizontal space.
Code
Intrinsic Centering
The data-layout-intrinsic attribute centers content that is narrower than the max-width.
This card is intrinsically centered.
Code
Text Centering
The data-layout-text attribute adds text-align: center for centered text content.
Centered Heading
All text content within this container is centered, making it perfect for hero sections and call-to-action blocks.
Combined: Intrinsic + Text
Both container and text are centered.
Code
Gutter Variants
The data-layout-gutter attribute controls horizontal padding (useful for nested centers).
data-layout-gutter="none"
No side padding - content touches edges.
data-layout-gutter="s"
Small gutter padding.
data-layout-gutter="l"
Large gutter padding.
Usage Examples
Page Layout
Hero Section
Welcome to Our Platform
Build amazing products with our comprehensive toolkit designed for modern development.
Article Content
Article Title
The narrow max-width ensures optimal line length for reading. Research shows that 45-75 characters per line is ideal for readability.
This container automatically centers itself and maintains comfortable margins on all screen sizes.
Form Container
Sign In
CSS Implementation
Related Elements
- layout-stack - Vertical stacking layout
- layout-cover - Full-height vertically centered layout
- layout-text - Typography container