Sizing

Apply responsive physical and logical width and height utility classes.

Syntax

Use .w-* and .h-* to set the physical width or height of an element. The scale uses percentages relative to the containing block and includes auto.

HTML
<div class="w-100 h-50">Full width, half height</div>
<div class="w-auto h-auto">Automatic width and height</div>

Class reference

PatternDimension
.w-{value}, .h-{value}Physical width and height.
.inline-size-{value}, .block-size-{value}Dimensions along and across the text flow.
SuffixValue
100100%
7575%
6060%
5050%
4040%
3030%
2525%
autoauto

Use .inline-size-* and .block-size-* when the dimension should follow the element’s writing mode. inline-size is the text-flow direction and block-size is perpendicular to it, so these utilities remain correct in right-to-left and vertical writing modes.

HTML
<article class="inline-size-100 block-size-auto">Writing-mode aware content</article>

Percentage heights need a containing block with a definite height. Use auto when content should determine the dimension.

Size content in its writing mode

The wrapper below uses vertical writing only to make the logical behavior visible. In that mode, inline-size controls the vertical text-flow direction and block-size controls the perpendicular dimension.

Logical dimensions
HTML
<div class="inline-size-75 block-size-100" style="writing-mode: vertical-rl;">
	Writing-mode aware content
</div>

Responsive behavior

Sizing utilities are mobile-first. Put the breakpoint between the utility name and its scale: .w-md-50, .h-lg-100, .inline-size-xl-75 or .block-size-xxl-auto.

w-100 w-md-75 w-lg-50
h-25 h-md-50 block-size-lg-75
HTML
<div class="inline-size-100 inline-size-md-75 block-size-auto block-size-lg-50">
	Responsive logical sizing
</div>

Variants use minimum widths; the later matching breakpoint wins independently of class order. See Breakpoints.

Recipes

Sizing utilities are useful for responsive content widths, equal-height layouts and dimensions that follow the writing mode instead of the physical screen direction.

Scale a content panel responsively

This panel uses the full available width on small screens, then becomes narrower at md and lg. mx-auto keeps the narrower panel centered.

Responsive panel

100% → 75% → 50% as the viewport grows.

HTML
<div class="w-100 w-md-75 w-lg-50 mx-auto">Responsive content panel</div>

Keep cards at the same height

In a grid row, h-100 lets cards stretch to the height of the tallest sibling. This keeps actions and supporting content aligned without hard-coding a pixel height.

Short summary

A compact card still fills the shared row height.

Longer summary

Both cards remain aligned when one contains more text or a longer action area.

HTML
<div class="grid gap-2">
	<div class="col-12 col-md-6">
		<article class="card h-100">Short summary</article>
	</div>
	<div class="col-12 col-md-6">
		<article class="card h-100">Longer summary</article>
	</div>
</div>