Skip to content

Container ​

A fixed-width, centered container: size maps to --oas-container-* width tokens, margin-inline: auto centers it (logical property, RTL-compliant automatically), and max-width: min(100%, token) prevents overflow on narrow screens.

Basic usage ​

Default lg centered

max-width: 992px

Sizes ​

size has six tiers: xs(480)/ sm(576)/ md(768)/ lg(992)/ xl(1200)/ full(100%). The container uses a hover background color to mark its actual width.

Six size tiers

xs · 480pxsm · 576pxmd · 768pxlg · 992pxxl · 1200pxfull · 100%

Disable centering ​

With center="false" centering is disabled (margin-inline: 0) and the container hugs the start of the line (the left side in LTR).

center=false

Left-aligned, no longer centered

Padding ​

padding accepts any token/value and applies to padding-inline (logical padding).

padding

16px padding on both sides of the content

Fluid ​

The fluid boolean attribute removes max-width entirely — the container always spans 100% of its parent (pure fluid). It is orthogonal to size: when present, the size width limit is ignored. Suitable for content that must fill the width while keeping the narrow-screen protection of width: 100%.

fluid vs fixed width

fluid · spans 100%size="md" · 768px fixed (comparison)

Breakout ​

Any slotted child with a breakout attribute breaks out of the fixed width to span the full viewport width (classic formula width: 100vw + margin-inline: calc(50% - 50vw)). Ideal for a "constrained content, full-width local banner" page structure.

breakout — full-width banner

First paragraph of constrained content
breakout banner · breaks 768px to span the viewport
Second paragraph of constrained content

Viewport scrollbar note: 100vw includes the vertical scrollbar width, so a breakout element can overflow horizontally when the page shows a scrollbar. Suppress it with overflow-x: clip (or overflow-x: hidden) on a top-level page wrapper — not on the container itself (that would clip the breakout).

Empty container ​

An empty container causes no error and takes no placeholder.

Empty container

API ​

oas-container ​

Attributes ​

AttributeDescriptionTypeDefault
centerWhether to center (center="false" disables)stringtrue
fluidBoolean; removes max-width entirely (pure fluid 100%). Orthogonal to size — when present, the size width limit is ignoredboolean—
paddingPadding token/value (applies to padding-inline)——
sizeFixed-width tier, mapped to --oas-container-* tokensstringlg

Slots ​

NameDescription
defaultContainer content

CSS Variables ​

CSS VariableDefault
--oas-container-full—
--oas-container-lg—
--oas-container-maxvar(--oas-container-lg, 992px)
--oas-container-md—
--oas-container-padding0
--oas-container-sm—
--oas-container-xl—
--oas-container-xs—

Released under the MIT OR Apache-2.0 License.