Tailwind CSS Container (original) (raw)

Last Updated : 23 Jul, 2025

**The Tailwind CSS container class is used to constrain the width of content and ensure responsive, centered layouts.

Welcome to Tailwind CSS

This is a simple example demonstrating the use of the container class in Tailwind CSS.

`

Breakpoints in Tailwind CSS

**Breakpoint **min-width
**sm 640px
**md 768px
**lg 1024px
**xl 1280px
**2xl 1536px

Tailwind CSS does not center itself automatically and also does not contain any pre-defined padding. The following are some utility classes that make the container class stand out.

**mx-auto Class

To center the container, we use **mx-auto utility class. It adjust the margin of the container automatically so that the container appears to be in center.

**Syntax:

...

HTML `

This is centered using the mx-auto class.
Another centered section with a different background color.

`

**In this Example:

**px-{size} Class

To add padding the container, we use _px-{size} utility class. It adds horizontal padding to the container which is equal to the size mentioned.

**Syntax:

...

HTML `

GeeksforGeeks


This container has horizontal padding of 5rem (80px) on both sides.

`

Best Practices for Using Tailwind CSS Container