Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can i customize container width in tailwind-css?

tailwind CSS container width in 2xl is not desired for me . how can I change it ? enter image description here

I want to remove its default width in 2xl . How can I do it?

like image 762
morteza mortezaie Avatar asked Sep 13 '25 21:09

morteza mortezaie


2 Answers

Or if you need some custom solution not directly connected with your "screens" configuration (as suggested by JHeth) you can configure container behavior separately like this:

module.exports= {
    theme: {
        container: {
            screens: {
                'sm': '100%',
                'md': '100%',
                'lg': '1024px',
                'xl': '1280px',
                '2xl': '1600px',
            }
        }
    }
}
like image 162
Picard Avatar answered Sep 15 '25 11:09

Picard


Add only necessary breakpoints to tailwind.config.js. Default values you can see in tailwind theme config

module.exports= {
    theme: {
        screens: {
            'sm': '640px', // => @media (min-width: 640px) { ... }
            'md': '768px', // => @media (min-width: 768px) { ... }
            'lg': '1024px', // => @media (min-width: 1024px) { ... }
            'xl': '1280px', // => @media (min-width: 1280px) { ... }
        }
    }
}
like image 32
Viktor Avatar answered Sep 15 '25 11:09

Viktor