Max-Width

Utilities for setting the maximum 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
.max-w-xs max-width: 20rem;
.max-w-sm max-width: 24rem;
.max-w-md max-width: 28rem;
.max-w-lg max-width: 32rem;
.max-w-xl max-width: 36rem;
.max-w-2xl max-width: 42rem;
.max-w-3xl max-width: 48rem;
.max-w-4xl max-width: 56rem;
.max-w-5xl max-width: 64rem;
.max-w-6xl max-width: 72rem;
.max-w-full max-width: 100%;

Customizing

Max-Width Scale

By default Tailwind provides ten max-width utilities. You change, add, or remove these by editing the theme.maxWidth section of your Tailwind config.

// tailwind.config.js
module.exports = {
theme: {
maxWidth: {
      'xs': '20rem',
      'sm': '24rem',
      'md': '28rem',
      'lg': '32rem',
      'xl': '36rem',
-     '2xl': '42rem',
-     '3xl': '48rem',
-     '4xl': '56rem',
-     '5xl': '64rem',
-     '6xl': '72rem',
+     '1/4': '25%',
+     '1/2': '50%',
+     '3/4': '75%',
      'full': '100%',
}
}
}

Responsive and State Variants

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

You can control which variants are generated for the max-width utilities by modifying the maxWidth property in the variants section of your tailwind.config.js file.

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

// tailwind.config.js
module.exports = {
variants: {
    // ...
-   maxWidth: ['responsive'],
+   maxWidth: ['responsive', 'hover', 'focus'],
}
}

Disabling

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

// tailwind.config.js
module.exports = {
corePlugins: {
    // ...
+   maxWidth: false,
}
}