Blog Post Title
Blog content goes here...
Containers are used to contain, pad, and (sometimes) center the content within them. While containers can be nested, most layouts do not require a nested container.
Responsive fixed-width container
<div class="container"></div>Full width container, spanning the entire width
<div class="container-fluid"></div>Containers that are 100% wide until a breakpoint
.container-sm.container-md.container-lg.container-xl.container-xxl| Container | Extra small <576px | Small ≥576px | Medium ≥768px | Large ≥992px | X-Large ≥1200px | XX-Large ≥1400px |
|---|---|---|---|---|---|---|
.container | 100% | 540px | 720px | 960px | 1140px | 1320px |
.container-sm | 100% | 540px | 540px | 540px | 540px | 540px |
.container-md | 100% | 100% | 720px | 720px | 720px | 720px |
.container-lg | 100% | 100% | 100% | 960px | 960px | 960px |
.container-xl | 100% | 100% | 100% | 100% | 1140px | 1140px |
.container-xxl | 100% | 100% | 100% | 100% | 100% | 1320px |
This container is fluid until the md breakpoint (768px), then becomes fixed width.
<div class="container-md">
<!-- Content -->
</div><div class="container-fluid">
<div class="container">Content 1</div>
<div class="container">Content 2</div>
</div>Use .container for centered, fixed-width layouts.
Use .container-fluid for edge-to-edge designs.
.container-sm.container-md.container-lg.container-xlContainers have built-in horizontal padding. You can adjust this with utility classes:
<div class="container px-0"></div><div class="container px-5"></div>padding-right: 12px and padding-left: 12px by default at all breakpoints.| Use Case | Recommended Container | Example |
|---|---|---|
| Blog, News Site | .container | Medium.com, blogs |
| Admin Dashboard | .container-fluid | Analytics dashboards |
| Landing Page | .container or .container-fluid | Marketing pages |
| E-commerce Product Page | .container | Amazon product pages |
| Portfolio Website | .container-fluid | Creative portfolios |
| Web Application | .container-fluid | Gmail, Trello |
Blog content goes here...
<div class="container">
<header>...</header>
<div class="row">
<main class="col-md-8">...</main>
<aside class="col-md-4">...</aside>
</div>
<footer>...</footer>
</div><div class="container-fluid">
<div class="row">
<nav class="col-md-2">Sidebar</nav>
<main class="col-md-10">Main Content</main>
</div>
</div>| Issue | Solution |
|---|---|
| Content touching edges on mobile | Use .container instead of .container-fluid |
| Too much white space on desktop | Use .container-fluid or responsive containers |
| Layout breaking at specific screen sizes | Use appropriate breakpoint container |
| Nested containers causing double padding | Avoid nesting containers, use rows and columns instead |