Didn’t find the answer you were looking for?
What's the difference between `.container` and `.container-fluid` in Bootstrap, and when should I use each?
Asked on Nov 24, 2025
Answer
In Bootstrap, ".container" and ".container-fluid" are used to create responsive layouts, but they differ in how they handle width. ".container" provides a fixed-width layout that adapts to different screen sizes, while ".container-fluid" offers a full-width layout that spans the entire width of the viewport.
<!-- BEGIN COPY / PASTE -->
<!-- Fixed-width container -->
<div class="container">
<p>This is a fixed-width container.</p>
</div>
<!-- Full-width container -->
<div class="container-fluid">
<p>This is a full-width container.</p>
</div>
<!-- END COPY / PASTE -->Additional Comment:
✅ Answered with Bootstrap 5 best practices.- Use ".container" when you want your content to be centered and have a maximum width that adapts to the screen size.
- Use ".container-fluid" when you want your content to take up the full width of the viewport, regardless of screen size.
- ".container" is ideal for most standard layouts, while ".container-fluid" is useful for edge-to-edge designs.
Recommended Links:
