Container - Keep React
Table of Contents#
Container Breakpoints#
The container
class sets the maximum width of an element to match the minimum width of the current screen size. This is useful if you want to design for specific screen sizes instead of a fully flexible layout.
Class | Breakpoint | Properties |
---|---|---|
container | None | width: 100% |
sm (640px) | max-width: 640px | |
md (768px) | max-width: 768px | |
lg (1024px) | max-width: 1024px | |
xl (1280px) | max-width: 1280px | |
2xl (1536px) | max-width: 1536px |
Centering Container#
To automatically center containers, you can enable the center
option as true
in your tailwind.config.ts
file:
Horizontal padding#
You can add horizontal padding to containers by setting the padding
option in your tailwind.config.ts
file:
Breakpoints padding#
If you need different padding for each screen size, you can specify a default value and override it for specific breakpoints using an object:
Reference#
If you want to know more about container class then you can read the documentation of tailwind css container.