Max-Width
Utilities for setting the maximum width of an element
Default class reference
| Class | Properties |
|---|---|
| max-w-0 | max-width: 0rem; |
| max-w-none | max-width: none; |
| 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-7xl | max-width: 80rem; |
| max-w-full | max-width: 100%; |
| max-w-min | max-width: min-content; |
| max-w-max | max-width: max-content; |
| max-w-prose | max-width: 65ch; |
| max-w-screen-sm | max-width: 640px; |
| max-w-screen-md | max-width: 768px; |
| max-w-screen-lg | max-width: 1024px; |
| max-w-screen-xl | max-width: 1280px; |
| max-w-screen-2xl | max-width: 1536px; |
Usage
Set the maximum width of an element using the max-w-{size} utilities.

1. <div class="max-w-md mx-auto ...">
2. max-w-md
3. </div>
Prose
We added a new max-width by default called max-w-prose. If you are familiar with the typography plugin you might recognize this one. The idea behind this class is that it allows you to have an optimal reading width.

1. <div class="max-w-prose ...">
2. <p class="font-bold">Why do you never see elephants hiding in trees?</p>
3. <p>Because they're so good at it. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas cupiditate laboriosam fugiat.</p>
4. </div>
Responsive
To control the max-width of an element at a specific breakpoint, add a {screen}: prefix to any existing max-width utility.
1. <div class="max-w-sm md:max-w-lg ...">
2. <!-- ... -->
3. </div>
For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.
Customizing
Max-Width Scale
Customize Tailwind’s default max-width scale in the theme.maxWidth section of your tailwind.config.js file.
1. // tailwind.config.js
2. module.exports = {
3. theme: {
4. maxWidth: {
5. + '1/4': '25%',
6. + '1/2': '50%',
7. + '3/4': '75%',
8. }
9. }
10. }
Learn more about customizing the default theme in the theme customization documentation.
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:
1. // tailwind.config.js
2. module.exports = {
3. variants: {
4. extend: {
5. // ...
6. + maxWidth: ['hover', 'focus'],
7. }
8. }
9. }
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:
1. // tailwind.config.js
2. module.exports = {
3. corePlugins: {
4. // ...
5. + maxWidth: false,
6. }
7. }
