Overview
Width utilities cover fixed size steps, fractions, and keyword widths in one suffix system.| Pattern | Supported values |
|---|---|
width-<size> | 3xs, 2xs, xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl, 6xl, 7xl |
width-<fraction> | 1-2, 1-3, 2-3, 1-4, 3-4 |
width-<value> | px, auto, full, screen |
Examples
Using the size scale
Use the t-shirt width scale when you want a predictable fixed content width for cards, panels, and shells.| Pattern | Supported classes | What it controls |
|---|---|---|
width-<size> | width-3xs, width-2xs, width-xs, width-sm, width-md, width-lg, width-xl, width-2xl, width-3xl, width-4xl, width-5xl, width-6xl, width-7xl | Fixed widths based on the size ladder |
Using a percentage
Use fractional width utilities when the layout itself is column-based and width should be relative to the parent.| Pattern | Supported classes | What it controls |
|---|---|---|
width-<fraction> | width-1-2, width-1-3, width-2-3, width-1-4, width-3-4 | Width as a percentage of the parent |
Filling the available width
Usewidth-full when an element should stretch across the full available width of its parent.
| Pattern | Supported classes | What it controls |
|---|---|---|
width-full | width-full | Fills the available parent width |
Matching the viewport
Usewidth-screen when an element should span the full viewport width instead of just the width of its parent container.
| Pattern | Supported classes | What it controls |
|---|---|---|
width-screen | width-screen | Matches the viewport width |
Resetting the width
Usewidth-auto when an element should size itself to its content or when you need to remove a previously assigned width.
| Pattern | Supported classes | What it controls |
|---|---|---|
width-auto | width-auto | Sizes to content or surrounding layout context |
Best Practices
- Use
width-fullfor forms, rows, and blocks that should stretch with their parent. - Use
width-<fraction>when the layout itself is column-based. - Use
width-<size>for fixed shells and readable content rails. - Use
width-screensparingly because it ignores the document container width.
Related Utilities
Max Width
Constrain maximum element width
Height
Control element height

