Height
Height utilities control how tall an element can be, how it responds to its parent, and how it behaves across responsive breakpoints.
Use them for full-screen sections, fixed-height panels, media previews, scrollable areas, equal-height cards, dashboard shells and responsive vertical layouts.
Quick reference
| Classes | Purpose |
|---|---|
h-auto, h-full, h-screen, h-min, h-max, h-fit | Control native height behavior, full parent height, viewport height and intrinsic content sizing. |
h-0, h-px, h-1 → h-96 | Set predictable fixed heights from the FrontAlign spacing scale. |
min-h-0, min-h-full, min-h-screen | Set minimum vertical constraints for layouts that need to grow or shrink safely. |
max-h-full, max-h-screen, max-h-48, max-h-64, max-h-96 | Limit vertical growth for dropdowns, scroll panels, modal bodies, lists and code blocks. |
h-1fr4, h-1fr3, h-1fr2, h-2fr3, h-3fr4 | Size an element as a percentage of a parent with a defined height. |
sm:, md:, lg:, xl:, 2xl: | Change height behavior from a breakpoint and above. |
h-fullh-automin-h-screenmax-h-24 overflow-y-autoContent past this point is clipped and becomes scrollable.
Usage
Use height utilities directly on any element.
<div class="h-full">
Full height element
</div>
<section class="min-h-screen">
Full screen section
</section>
<div class="h-64">
Fixed height panel
</div>
Height utilities work best when combined with layout utilities such as is-flex, is-grid, place-center, overflow-y-auto, flex-1 and min-h-0.
Core height
Core utilities cover common native CSS height values.
| Class | CSS output | Purpose |
|---|---|---|
h-auto | height: auto; | Let the browser determine the height. |
h-full | height: 100%; | Fill the available parent height. |
h-screen | height: 100vh; + height: 100dvh; | Match the viewport height with modern mobile viewport support. |
h-min | height: min-content; | Shrink to the minimum content height. |
h-max | height: max-content; | Expand to the maximum content height. |
h-fit | height: fit-content; | Fit the content while respecting available space. |
<section class="h-screen is-flex place-center">
Full screen hero
</section>
<div class="h-fit">
Content-sized panel
</div>
Viewport height
h-screen, min-h-screen and max-h-screen use both 100vh and 100dvh.
.h-screen {
height: 100vh;
height: 100dvh;
}
.min-h-screen {
min-height: 100vh;
min-height: 100dvh;
}
.max-h-screen {
max-height: 100vh;
max-height: 100dvh;
}
100vh provides broad fallback behavior. 100dvh improves viewport handling on modern mobile browsers where the browser UI can change the visible viewport height.
Min and max height
Min and max height utilities are useful for full-height layouts, scroll regions and overflow control.
| Class | CSS output | Use case |
|---|---|---|
min-h-0 | min-height: 0; | Allow flex or grid children to shrink properly. |
min-h-full | min-height: 100%; | Ensure an element is at least as tall as its parent. |
min-h-screen | min-height: 100vh; + 100dvh | Create full-screen sections that can grow with content. |
max-h-full | max-height: 100%; | Prevent an element from exceeding its parent height. |
max-h-screen | max-height: 100vh; + 100dvh | Limit an element to the viewport height. |
<section class="min-h-screen is-flex place-center">
Full screen section
</section>
<div class="h-screen is-flex flex-col">
<header class="h-16">Header</header>
<main class="min-h-0 flex-1 overflow-y-auto">
Scrollable content
</main>
</div>
Fixed height scale
Fixed height utilities are useful for icons, avatars, media previews, cards, panels, skeletons and controlled UI surfaces.
| Class | Height | Class | Height |
|---|---|---|---|
h-0 | 0 | h-px | 1px |
h-1 | 0.25rem | h-8 | 2rem |
h-2 | 0.5rem | h-10 | 2.5rem |
h-3 | 0.75rem | h-12 | 3rem |
h-4 | 1rem | h-16 | 4rem |
h-5 | 1.25rem | h-24 | 6rem |
h-6 | 1.5rem | h-64 | 16rem |
h-32 | 8rem | h-96 | 24rem |
h-7 | 1.75rem | h-20 | 5rem |
h-40 | 10rem | h-48 | 12rem |
<div class="is-flex align-items-center gap-3">
<div class="h-12 w-12">Icon</div>
<div class="h-64">Preview</div>
</div>
Max height scale
Max height utilities limit vertical growth and are useful for scrollable panels, dropdowns, code blocks, lists and modal bodies.
| Class | CSS output |
|---|---|
max-h-48 | max-height: 12rem; |
max-h-64 | max-height: 16rem; |
max-h-96 | max-height: 24rem; |
<div class="max-h-64 overflow-y-auto">
Scrollable content
</div>
Fractional heights
Fractional height utilities map common layout fractions to percentages. They are useful when the parent has a defined height.
| Class | Height | Meaning |
|---|---|---|
h-1fr4 | 25% | One quarter of parent height. |
h-1fr3 | 33.333333% | One third of parent height. |
h-1fr2 | 50% | Half of parent height. |
h-2fr3 | 66.666667% | Two thirds of parent height. |
h-3fr4 | 75% | Three quarters of parent height. |
h-1fr4h-1fr3h-1fr2h-2fr3h-3fr4<div class="h-64">
<div class="h-1fr2">
Half height
</div>
</div>
Full screen hero
Use min-h-screen instead of h-screen when content may grow.
<section class="min-h-screen is-flex place-center">
<div>
<h1>Build modern interfaces faster.</h1>
<p>FrontAlign keeps the section full-height while allowing content to grow.</p>
</div>
</section>
Media preview
Use fixed heights for media and preview panels.
<div class="h-64 is-flex place-center">
Preview
</div>
Scrollable panel
Use max-height with overflow utilities for contained scroll areas.
<div class="max-h-64 overflow-y-auto">
Long content
</div>
Equal height cards
Use Grid or Flexbox with height utilities to create consistent card previews.
<div class="is-grid grid-cols-3 gap-4">
<article class="h-48">Card</article>
<article class="h-48">Card</article>
<article class="h-48">Card</article>
</div>
Dashboard shell
Use min-h-0 when a nested area should be allowed to shrink and scroll inside a fixed-height layout.
<div class="h-screen is-flex flex-col">
<header class="h-16">Header</header>
<main class="min-h-0 flex-1 overflow-y-auto">
Scrollable content
</main>
</div>
Responsive Class Reference
| Base class | Responsive variants |
|---|---|
h-auto | sm:h-auto, md:h-auto, lg:h-auto, xl:h-auto, 2xl:h-auto |
h-full | sm:h-full, md:h-full, lg:h-full, xl:h-full, 2xl:h-full |
h-fit | sm:h-fit, md:h-fit, lg:h-fit, xl:h-fit, 2xl:h-fit |
min-h-0 | sm:min-h-0, md:min-h-0, lg:min-h-0, xl:min-h-0, 2xl:min-h-0 |
min-h-full | sm:min-h-full, md:min-h-full, lg:min-h-full, xl:min-h-full, 2xl:min-h-full |
max-h-full | sm:max-h-full, md:max-h-full, lg:max-h-full, xl:max-h-full, 2xl:max-h-full |
h-1fr4 | sm:h-1fr4, md:h-1fr4, lg:h-1fr4, xl:h-1fr4, 2xl:h-1fr4 |
h-1fr3 | sm:h-1fr3, md:h-1fr3, lg:h-1fr3, xl:h-1fr3, 2xl:h-1fr3 |
h-1fr2 | sm:h-1fr2, md:h-1fr2, lg:h-1fr2, xl:h-1fr2, 2xl:h-1fr2 |
h-2fr3 | sm:h-2fr3, md:h-2fr3, lg:h-2fr3, xl:h-2fr3, 2xl:h-2fr3 |
h-3fr4 | sm:h-3fr4, md:h-3fr4, lg:h-3fr4, xl:h-3fr4, 2xl:h-3fr4 |
Responsive variants are mobile-first. A base height applies immediately. A responsive height applies from its breakpoint and above.
<div class="h-auto md:h-full">
Responsive height
</div>
Height vs min-height
Use height when the element should have a fixed or strict height. Use min-height when the element should be at least a certain height but can grow with content.
| Use height for | Use min-height for |
|---|---|
Media previews and fixed panels. | Hero sections with dynamic content. |
Icons, avatars and skeletons. | Sections that must fill the screen but can expand. |
Strict scroll regions. | Flexible page layouts. |
Notes
- Use
h-screenfor strict viewport-height sections. - Use
min-h-screenwhen content may grow beyond the viewport. - Use
max-h-*withoverflow-y-autofor scrollable panels. - Use
min-h-0to fix overflow inside Flexbox and Grid children. - Fractional height utilities require the parent to have a defined height.
- Responsive height variants follow FrontAlign's mobile-first breakpoint system.