Note that unlike containers you might have used in other frameworks, Tailwind’s container does not center itself automatically and does not have any built-in horizontal padding.
To center a container, use the utility:
To add horizontal padding, use the .px-{size}
utilities:
Customizing
To center containers by default, set the center
option to in the plugins section of your config file:
To add horizontal padding by default, specify the amount of padding you’d like using the padding
option in the plugins section of your config file:
Unlike most of Tailwind’s other styles, the container component is included as a built-in plugin rather than a traditional utility module. To disable it, remove the plugin from the plugins
section of your config file:
// …
plugins: [
- require(‘tailwindcss/plugins/container’)(),
}