Sizing

Easily make an element as wide or as tall (relative to its parent) with our width and height utilities.

Width and height utilities are generated from the $sizes Sass map in _variables.scss. Includes support for 25%, 50%, 75%, 100%, and auto by default. Modify those values as you need to generate different utilities here.

Width 25%
Width 50%
Width 75%
Width 100%
Width auto
<div class="w-25 p-3" style="background-color: #eee;">Width 25%</div>
<div class="w-50 p-3" style="background-color: #eee;">Width 50%</div>
<div class="w-75 p-3" style="background-color: #eee;">Width 75%</div>
<div class="w-100 p-3" style="background-color: #eee;">Width 100%</div>
<div class="w-auto p-3" style="background-color: #eee;">Width auto</div>
Height 35%
Height 50%
Height 75%
Height 100%
Height auto
<div style="height: 200px;">
    <div class="h-35 d-inline-block p-3 align-top bg-primary text-white" style="width: 120px;">Height 35%</div>
    <div class="h-50 d-inline-block p-3 align-top bg-primary text-white" style="width: 120px;">Height 50%</div>
    <div class="h-75 d-inline-block p-3 align-top bg-primary text-white" style="width: 120px;">Height 75%</div>
    <div class="h-100 d-inline-block p-3 align-top bg-primary text-white" style="width: 120px;">Height 100%</div>
    <div class="h-auto d-inline-block p-3 align-top bg-primary text-white" style="width: 120px;">Height auto</div>
</div>

You can also use max-width: 100%; and max-height: 100%; utilities as needed.

Max-width = 100% [1000%x100]
<img class="mw-100" data-src="holder.js/1000px100?text=Max-width%20%3D%20100%25" alt="Max-width = 100% [1000%x100]" style="height: 100px; width: 1000%; display: block;" src="data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%22912%22%20height%3D%22100%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20912%20100%22%20preserveAspectRatio%3D%22none%22%3E%3Cdefs%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E%23holder_16ac633a160%20text%20%7B%20fill%3Argba(255%2C255%2C255%2C.75)%3Bfont-weight%3Anormal%3Bfont-family%3AHelvetica%2C%20monospace%3Bfont-size%3A46pt%20%7D%20%3C%2Fstyle%3E%3C%2Fdefs%3E%3Cg%20id%3D%22holder_16ac633a160%22%3E%3Crect%20width%3D%22912%22%20height%3D%22100%22%20fill%3D%22%23777%22%3E%3C%2Frect%3E%3Cg%3E%3Ctext%20x%3D%22202.8984375%22%20y%3D%2271%22%3EMax-width%20%3D%20100%25%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E" data-holder-rendered="true">
Max-height 100%
<div style="height: 100px; background-color: #f9fbfd;">
    <div class="p-2 mh-100 bg-primary text-white" style="width: 100px; height: 200px;">Max-height 100%</div>
</div>
Top