Width

Utilities for setting the width of an element.

Quick reference

ClassProperties
.w-25width: 25%;
.w-50width: 50%;
.w-75width: 75%;
.w-100width: 100%;
.w-autowidth: auto;
.vw-100width: 100vw;
.mw-100max-width: 100%;
.min-vw-100min-width: 100vw;

Basic usage

Fixed width

Use w-{number} to set an element to a fixed width.

w-100
w-75
w-50
w-25
<div class="w-100 text-bg-primary p-1 rounded">w-100</div>
<div class="w-75 text-bg-primary p-1 rounded">w-75</div>
<div class="w-50 text-bg-primary p-1 rounded">w-50</div>
<div class="w-25 text-bg-primary p-1 rounded">w-25</div>

Auto width

Use w-auto to set width of an element to an auto.

w-auto
w-auto
<span class="w-auto text-bg-primary p-1 rounded">w-auto</span><br/>
<div class="w-auto text-bg-primary p-1 rounded mt-3">w-auto</div>

Full viewport width

Use vw-100 to make an element span the entire width of the viewport.

<div class="vw-100"></div>

Max width

Use mh-100 to set the maximum height of an element that is full, depending on the parent element.

max-width 100%
<div class="bg-purple-50 p-3 col-8">
  <div class="bg-purple-300 text-white p-1 col-12 mw-100 h-100">
    max-width 100%
  </div>
</div>