Skip to content

Width

Width utilities. Included in @grundtone/design-tokens CSS — see Installation for setup.

All utilities support responsive prefixes: sm:, md:, lg:, xl:, 2xl:.


Keyword widths

.w-auto
.w-full
.w-fit
ClassCSS
.w-autowidth: auto
.w-fullwidth: 100%
.w-screenwidth: 100vw
.w-minwidth: min-content
.w-maxwidth: max-content
.w-fitwidth: fit-content

Fractional widths

Common layout fractions — use these for typical column-style splits.

.w-25
.w-33
.w-50
.w-66
.w-75
.w-full
ClassCSS
.w-25width: 25%
.w-33width: 33.333333%
.w-50width: 50%
.w-66width: 66.666667%
.w-75width: 75%

Percentage widths (10% steps)

ClassCSS
.w-10width: 10%
.w-20width: 20%
.w-30width: 30%
.w-40width: 40%
.w-50width: 50%
.w-60width: 60%
.w-70width: 70%
.w-80width: 80%
.w-90width: 90%

Responsive

Change width at different breakpoints using the {breakpoint}: prefix:

Full on mobile, 50% from md up — resize to see
html
<!-- Full width on mobile, half from md, quarter from xl -->
<div class="w-full md:w-50 xl:w-25">Responsive element</div>

<!-- Auto width on mobile, fixed 33% from lg -->
<aside class="w-auto lg:w-33">Sidebar</aside>
ClassApplies from
.w-50All sizes
.sm:w-50≥ 640px
.md:w-50≥ 768px
.lg:w-50≥ 1024px
.xl:w-50≥ 1280px
.2xl:w-50≥ 1536px

See Breakpoints for the full breakpoint scale and customisation.