Tailwind CSS v1.0 is here! Learn more →

Width

Utilities for setting the width of an element

Work in progress!

More detailed documentation is coming soon, but in the meantime here's a quick class reference.

Class reference

Class Properties
.w-1 width: 0.25rem;
.w-2 width: 0.5rem;
.w-3 width: 0.75rem;
.w-4 width: 1rem;
.w-6 width: 1.5rem;
.w-8 width: 2rem;
.w-10 width: 2.5rem;
.w-12 width: 3rem;
.w-16 width: 4rem;
.w-24 width: 6rem;
.w-32 width: 8rem;
.w-48 width: 12rem;
.w-64 width: 16rem;
.w-auto width: auto;
.w-px width: 1px;
.w-1/2 width: 50%;
.w-1/3 width: 33.33333%;
.w-2/3 width: 66.66667%;
.w-1/4 width: 25%;
.w-3/4 width: 75%;
.w-1/5 width: 20%;
.w-2/5 width: 40%;
.w-3/5 width: 60%;
.w-4/5 width: 80%;
.w-1/6 width: 16.66667%;
.w-5/6 width: 83.33333%;
.w-full width: 100%;
.w-screen width: 100vw;

Customizing

Width Scale

By default Tailwind provides 15 fixed width utilities, 12 percentage-based utilities, an auto utility, and a utility for setting the width of an element to match the viewport width. You change, add, or remove these by editing the width section of your Tailwind config.

{
// ...
width: {
    'auto': 'auto',
    'px': '1px',
+   '2px': '2px',
    '1': '0.25rem',
    '2': '0.5rem',
    '3': '0.75rem',
    '4': '1rem',
    '5': '1.25rem',
    '6': '1.5rem',
    '8': '2rem',
-   '10': '2.5rem',
-   '12': '3rem',
-   '16': '4rem',
-   '24': '6rem',
-   '32': '8rem',
-   '48': '12rem',
-   '64': '16rem',
    '1/2': '50%',
    '1/3': '33.33333%',
    '2/3': '66.66667%',
    '1/4': '25%',
    '3/4': '75%',
    '1/5': '20%',
    '2/5': '40%',
    '3/5': '60%',
    '4/5': '80%',
    '1/6': '16.66667%',
    '5/6': '83.33333%',
    'full': '100%',
+   'screen-1/2': '50vw'
-   'screen': '100vw'
+   'screen-full': '100vw'
}
}

Responsive and State Variants

By default, only responsive variants are generated for width utilities.

You can control which variants are generated for the width utilities by modifying the width property in the modules section of your Tailwind config file.

For example, this config will also generate hover and focus variants:

{
// ...
modules: {
    // ...
-   width: ['responsive'],
+   width: ['responsive', 'hover', 'focus', 'active', 'group-hover'],
}
}

Disabling

If you don't plan to use the width utilities in your project, you can disable them entirely by setting the width property to false in the modules section of your config file:

{
// ...
modules: {
    // ...
-   width: ['responsive'],
+   width: false,
}
}