Width

Set the width for an element.

Widely available

This feature is well established and works across many devices and browser versions.

Chrome
Edge
Firefox
Safari

Usage

16
28
48
<div class="d-g rg-8">
<div class="p-1 w-16 bg-indigo c-white ta-c">16</div>
<div class="p-1 w-28 bg-indigo c-white ta-c">28</div>
<div class="p-1 w-48 bg-indigo c-white ta-c">48</div>
</div>

Percentages

100%
50%
<div class="d-g b-3 rg-8 p-2 w-64 bc-indigo bs-d">
<div class="p-2 w-full bg-indigo c-white ta-c">100%</div>
<div class="p-2 w-half bg-indigo c-white ta-c">50%</div>
</div>

Responsiveness

Use breakpoint prefixes to target different screen sizes. Styles apply from the breakpoint & up.

Target viewport sizes with breakpoint prefixes.

sm:w-*
Small640px
md:w-*
Medium768px
lg:w-*
Large1024px
xxl:w-*
Extra Large1536px

Hover State

Apply styles conditionally on hover using the h: prefix.

Add the h: prefix to apply styles only when the user hovers over the element.

Syntax:h:w-*

Negative Values

Use negative variants to apply negative width values.

Use the -- syntax to apply negative numeric values.

Syntax:w--*