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>

Max Width

Limit the maximum width of an element.

Widely available

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

Chrome
Edge
Firefox
Safari

Try changing the horizontal size of the box.
64
<div class="d-f o-auto ai-c jc-c max-w-64 min-w-16 p-6 w-32 bg-indigo c-white r-h">64</div>

Min Width

Set the minimum width of an element.

Widely available

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

Chrome
Edge
Firefox
Safari

Try changing the horizontal size of the box.
32
<div class="d-f o-auto ai-c jc-c max-w-64 min-w-16 p-6 w-32 bg-indigo c-white r-h">32</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--*