Width

Utilities for setting the width of an element


Class reference

ClassProperties
w-autowidth: auto;
w-0width: 0;
w-pxwidth: 1px;
w-0.5width: 0.125rem;
w-1width: 0.25rem;
w-1.5width: 0.375rem;
w-2width: 0.5rem;
w-2.5width: 0.625rem;
w-3width: 0.75rem;
w-3.5width: 0.875rem;
w-4width: 1rem;
w-4.5width: 1.125rem;
w-5width: 1.25rem;
w-6width: 1.5rem;
w-7width: 1.75rem;
w-8width: 2rem;
w-9width: 2.25rem;
w-10width: 2.5rem;
w-11width: 2.75rem;
w-12width: 3rem;
w-13width: 3.25rem;
w-14width: 3.5rem;
w-15width: 3.75rem;
w-16width: 4rem;
w-18width: 4.5rem;
w-20width: 5rem;
w-24width: 6rem;
w-28width: 7rem;
w-32width: 8rem;
w-36width: 9rem;
w-40width: 10rem;
w-48width: 12rem;
w-56width: 14rem;
w-60width: 15rem;
w-64width: 16rem;
w-72width: 18rem;
w-80width: 20rem;
w-96width: 24rem;
w-1/2width: 50%;
w-1/3width: 33.333333%;
w-2/3width: 66.666667%;
w-1/4width: 25%;
w-2/4width: 50%;
w-3/4width: 75%;
w-1/5width: 20%;
w-2/5width: 40%;
w-3/5width: 60%;
w-4/5width: 80%;
w-1/6width: 16.666667%;
w-2/6width: 33.333333%;
w-3/6width: 50%;
w-4/6width: 66.666667%;
w-5/6width: 83.333333%;
w-1/12width: 8.333333%;
w-2/12width: 16.666667%;
w-3/12width: 25%;
w-4/12width: 33.333333%;
w-5/12width: 41.666667%;
w-6/12width: 50%;
w-7/12width: 58.333333%;
w-8/12width: 66.666667%;
w-9/12width: 75%;
w-10/12width: 83.333333%;
w-11/12width: 91.666667%;
w-fullwidth: 100%;
w-screenwidth: 100vw;
w-minwidth: min-content;
w-maxwidth: max-content;
w-screen-25width: 25vw;
w-screen-50width: 50vw;
w-screen-75width: 75vw;
w-screen-100width: 100vw;

# Auto

Use .w-auto to let the browser calculate and select the width for the element.

<div class="w-24 md:w-auto ..."></div>

# Screen Width

Use .w-screen to make an element span the entire width of the viewport.

<div class=" h-12 w-screen"></div>

# Fixed Width

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

w-8

w-12

w-16

w-24

<div>
<div class="w-8 ..."></div>
<div class="w-12 ..."></div>
<div class="w-16 ..."></div>
<div class="w-24 ..."></div>
</div>

# Fluid Width

Use .w-{fraction} or .w-full to set an element to a percentage based width.

w-1/2
w-1/2
w-2/5
w-3/5
w-1/3
w-2/3
w-1/4
w-3/4
w-1/5
w-4/5
w-1/6
w-5/6
w-full
<div class="flex ...">
<div class="w-1/2 ... ">w-1/2</div>
<div class="w-1/2 ..."">w-1/2</div>
</div>
<div class="flex ...">
<div class="w-2/5 ...">w-2/5</div>
<div class="w-3/5 ...">w-3/5</div>
</div>
<div class="flex ...">
<div class="w-1/3 ...">w-1/3</div>
<div class="w-2/3 ...">w-2/3</div>
</div>
<div class="flex ...">
<div class="w-1/4 ...">w-1/4</div>
<div class="w-3/4 ...">w-3/4</div>
</div>
<div class="flex ...">
<div class="w-1/5 ...">w-1/5</div>
<div class="w-4/5 ...">w-4/5</div>
</div>
<div class="flex ...">
<div class="w-1/6 ...">w-1/6</div>
<div class="w-5/6 ...">w-5/6</div>
</div>
<div class="w-full ...">w-full</div>

# Responsive

To control the width of an element at a specific breakpoint, add a {screen}: prefix to any existing width utility. For example, adding the class md:w-full to an element would apply the w-full utility at medium screen sizes and above.

<div class="w-1/2 **md:w-full** ...">
<!-- ... -->
</div>

For more information about Elements’ responsive design features, check out the Responsive Design documentation.