agyanadda@gmail.com

Tailwind Width and Height

Tailwind Layout 1 min read Updated Dec 1, 2026 Topic 10 of 27

Width

Class Width
w-64 16rem
w-1/2, w-1/3, w-3/4 fractions of the parent
w-full 100%
w-screen 100vw
w-auto, w-fit auto / fit content

Height

h-12, h-full, h-screen, min-h-screen (at least the full screen height — common for page layouts), h-dvh (mobile-friendly full height).

Both at once

size-10 sets width and height — perfect for icons and avatars.

Max width

Keep text readable and layouts centred:

max-w-sm, max-w-md, max-w-xl, max-w-4xl, max-w-7xl, max-w-prose

<main class="max-w-5xl mx-auto px-4">

This is the most common page wrapper in Tailwind.

Example

Example — Sizing utilities HTML
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>

<div class="p-6 space-y-3">
  <div class="w-full bg-rose-200 p-2">w-full</div>
  <div class="w-1/2 bg-rose-300 p-2">w-1/2</div>
  <div class="w-1/3 bg-rose-400 p-2">w-1/3</div>
  <div class="w-64 bg-rose-500 text-white p-2">w-64 (16rem)</div>
  <div class="flex gap-3 items-center">
    <div class="size-8 bg-indigo-500 rounded-full"></div>
    <div class="size-12 bg-indigo-500 rounded-full"></div>
    <div class="size-16 bg-indigo-500 rounded-full"></div>
  </div>
  <p class="max-w-md bg-slate-100 p-3 rounded">max-w-md keeps this paragraph from becoming too wide on large screens, which makes it easier to read.</p>
</div>

Test Yourself With Exercises

Exercise 1 Multiple Choice

Which class sets both width and height?

Exercise 2 True / False

min-h-screen makes an element at least as tall as the screen.

Exercise 3 Fill in the Blank

w-1/___ gives half the parent's width.

Frequently Asked Questions

Use an arbitrary value: w-[350px]. But prefer the scale or max-w-* so the design stays consistent and responsive.