Contents
Quick reference
Class | Properties |
---|---|
.h-25 | height: 25%; |
.h-50 | height: 50%; |
.h-75 | height: 75%; |
.h-100 | height: 100%; |
.h-auto | height: auto; |
.vh-100 | height: 100vh; |
.mh-100 | max-height: 100%; |
.min-vh-100 | min-height: 100vh; |
Basic usage
Fixed height
Use h-{number}
to set an element to a fixed height.
h-100
h-75
h-50
h-25
<div class="h-100 ..."></div>
<div class="h-75 ..."></div>
<div class="h-50 ..."></div>
<div class="h-25 ..."></div>
Full height
Use h-100
to set an element’s height to 100% of its parent, as long as the parent has a defined height.
<div class="h-48">
<div class="h-100 ...">
<!-- This element will have a height of `12rem` (h-48) -->
</div>
</div>
Vewport height
Use vh-100
to make an element span the entire height of the viewport.
<div class="vh-100"></div>
Max height
Use mh-100
to set the maximum height of an element that is full, depending on the parent element.
max-height 100%
<div style="height:100px">
<div style="height:200px">
max-height 100%
</div>
</div>
Edit this page on Github
Last edited by zhengchun on November 30, 2023