Bootstrap 5 Basic
Bootstrap 5 Utilities
Bootstrap 5 Flexbox
In Bootstrap 5, height utility classes allow you to control the height of elements easily. These classes can be used to set fixed heights, relative heights, or responsive heights for elements.
h-{side?}
h
: Indicates height.value
: The height value, which can be a percentage, fixed size, or responsive scale.Bootstrap includes predefined height classes that set the width as a percentage of the parent container:
Class |
Description |
---|---|
h-25 |
Height: 25% of the parent container. |
h-50 |
Height: 50% of the parent container. |
h-75 |
Height: 75% of the parent container. |
h-100 |
Height: 100% of the parent container. |
h-auto |
Automatically adjusts to content. |
Try it yourself
Bootstrap also provides classes to limit the maximum height of elements:
Class |
Description |
---|---|
mh-100 |
Max height: 100% of the parent. |
mh-auto |
Automatically adjusts height. |
Try it yourself