Browse CSS

Sizing

Control widths and center content without fixed mobile dimensions.

Widths

ClassBehavior
w-full100% of the available width.
w-autoAutomatic width.
w-fitFit-content width.
min-w-0Allow flex or grid content to shrink below its intrinsic width.
max-w-fullCap width at 100% of the containing block.
max-w-noneRemove a maximum width.
max-w-2xsMaximum inline size: 10rem.
max-w-xsMaximum inline size: 14rem.
max-w-smMaximum inline size: 18rem.
max-w-mdMaximum inline size: 24rem.
max-w-lgMaximum inline size: 32rem.
max-w-formMaximum width: 48rem.

Maximum sizes constrain a block without forcing it wider than a small screen. Combine w-full and a maximum-width utility when a block should fill available space up to a limit.

Height and flex sizing

ClassBehavior
h-autoContent-driven height.
h-full100% height; requires a definite parent height.
min-h-0Allow a flex/grid child to shrink vertically.
growAllow the item to grow and fill available flex space.
grow-0Prevent the item from growing to fill extra flex space.
shrink-0Prevent flex shrinking; use for icons or other fixed-size content.
aspect-squareA 1:1 aspect ratio.
aspect-videoA 16:9 aspect ratio.

Aspect ratios work when at least one dimension is automatic. Keep text containers content-driven so text zoom and translations can expand them.

Centered content

A compact summary

Full width on a small screen, centered and constrained when there is more room.

<div class="panel stack w-full max-w-sm mx-auto p-md gap-sm">
  <h3 class="m-0">A compact summary</h3>
  <p class="muted m-0">Content remains free to grow vertically.</p>
</div>