Skip to content

Width & Height

Class names

The width class names start with w.

ClassDescription
w-autoAuto width.
w-full100% width.
w-screenMakes the width equal to the screen size.
max-w-screenSets maximum width to the width of the screen.
max-w-dvwSets maximum width to the dynamic width of the screen.
min-w-0Minimum width of 0 px.
w-1/250% width.
w-1/333% width.
w-1/425% width.
w-1/520% width.
w-2/366% width.
w-2/540% width.
w-3/475% width.
w-3/560% width.
w-4/580% width.

The height class names start with h.

ClassDescription
h-autoAuto height.
h-full100% height.
h-screenMakes the width equal to the screen size.
h-1/250% height.

In case both width and height have to be applied and they must be the same, the size-* class can be used with a range from 4 to 12.

ClassDescription
size-fullFull size container.
size-4-12Width and height.
min-size-4Minimum width and height of var(--spacing)*4. Used for icons.
tile-xsExtra small size container.
tile-smSmall size container.
tile-mdMedium size container.
tile-lgLarge size container.

INFO

All of the classes above can be used with the ! prefix in order to force their use in case the target element already has a certain size set.

Width examples

Screen


html
<div class="flex w-screen justify-between bg-primary text-primary-foreground">
  <span>Start</span>
  <span>End</span>
</div>

TIP

You may have to horizontally scroll the container to see the "End" label.

Full


html
<div class="w-full bg-primary text-primary-foreground">Full width</div>

Fractions


html
<div class="flex gap-2">
  <div class="w-1/2 bg-primary text-primary-foreground">w-1/2</div>
  <div class="w-1/2 bg-primary text-primary-foreground">w-1/2</div>
</div>
<div class="flex gap-2">
  <div class="w-2/5 bg-primary text-primary-foreground">w-2/5</div>
  <div class="w-3/5 bg-primary text-primary-foreground">w-3/5</div>
</div>
<div class="flex gap-2">
  <div class="w-1/3 bg-primary text-primary-foreground">w-1/3</div>
  <div class="w-2/3 bg-primary text-primary-foreground">w-2/3</div>
</div>
<div class="flex gap-2">
  <div class="w-1/4 bg-primary text-primary-foreground">w-1/4</div>
  <div class="w-3/4 bg-primary text-primary-foreground">w-3/4</div>
</div>
<div class="flex gap-2">
  <div class="w-1/5 bg-primary text-primary-foreground">w-1/5</div>
  <div class="w-4/5 bg-primary text-primary-foreground">w-4/5</div>
</div>

Height examples

Full


html
<div class="h-full bg-primary text-primary-foreground">Full height</div>

Screen


html
<div class="h-screen bg-primary text-primary-foreground">Matches screen height</div>

Half


html
<div class="h-1/2 bg-primary text-primary-foreground">50% height</div>

Size examples


html
<div class="size-8 bg-primary text-xs text-primary-foreground">Size 8</div>
html
<div class="size-12 bg-primary text-primary-foreground">Size 12</div>
html
<div class="tile-xs bg-primary text-primary-foreground">Size Extra Small</div>
<div class="tile-sm bg-primary text-primary-foreground">Size Small</div>
<div class="tile-md bg-primary text-primary-foreground">Size Medium</div>
<div class="tile-lg bg-primary text-primary-foreground">Size Large</div>