Heights
Heights
Canvas provides fractional heights, viewport heights, and responsive height utilities on top of Bootstrap.
Note: the
.h-*prefix is also used by Canvas hover utilities (for example.h-bg-primary,.h-scale,.h-shadow). Those apply on hover and are covered on the relevant pages. This page covers actual sizing.
Fractional and auto heights
| Class | Height |
|---|---|
.h-0 |
0 |
.h-25 |
25% |
.h-40 |
40% |
.h-50 |
50% |
.h-60 |
60% |
.h-75 |
75% |
.h-90 |
90% |
.h-100 |
100% |
.h-auto |
auto |
These are also responsive: .h-sm-*, .h-md-*, .h-lg-*, .h-xl-*, .h-xxl-* (each with the 0/25/40/50/60/75/90/100/auto steps).
Viewport heights
Canvas ships min and max viewport height utilities using the same scale:
| Class | Effect |
|---|---|
.min-vh-0 to .min-vh-100 |
min-height in vh (steps 0/25/40/50/60/75/90/100) |
.max-vh-0 to .max-vh-100 |
max-height in vh (same steps) |
.max-vh-none |
remove max-height |
Both are responsive: .min-vh-md-75, .max-vh-lg-50, .max-vh-sm-none, and so on across all breakpoints.
Usage
Full viewport hero section:
<section class="min-vh-100 d-flex align-items-center">
<div class="container">
<h1>Full height hero</h1>
</div>
</section>Cap a scrolling panel to half the viewport on large screens:
<div class="max-vh-50 max-vh-lg-75 overflow-auto">
Long content that scrolls inside a bounded height.
</div>Fill the parent height:
<div class="h-100">Fills 100% of parent height</div>Classes
| Class | Description |
|---|---|
.min-vh-* | Sets a Minimum Height relative to the Viewport Sizes
Example: [ch_pre class="mb-3"] You can add Multiple Height Utility Classes on the same element for different responsive breakpoints |
.max-vh-* | Sets a Maximum Height relative to the Viewport Sizes
Example: [ch_pre class="mb-3"] You can add Multiple Height Utility Classes on the same element for different responsive breakpoints |
.vh-* | Sets a Fixed Height relative to the Viewport Sizes
Example: [ch_pre class="mb-3"] You can add Multiple Height Utility Classes on the same element for different responsive breakpoints |
.h-* | Sets a Fixed Height relative to the Parent Height Sizes
Example: [ch_pre class="mb-3"] You can add Multiple Height Utility Classes on the same element for different responsive breakpoints |
More Sizing Classes | More Sizing Utility Classes can be found here: https://getbootstrap.com/docs/5.3/utilities/sizing/ . |
