Bootstrap 5 Basic
Bootstrap 5 Flexbox
In Bootstrap 5, the .container
class is used to create a responsive and fixed-width layout that automatically adjusts to different screen sizes. Here’s a breakdown of its features and variations:
.container
class creates a responsive, fixed-width container that adapts based on the viewport size. It maintains specific max-widths at different breakpoints (e.g., sm
, md
, lg
, etc.)..container-fluid
to create a full-width container that spans the entire viewport width, regardless of screen size. This is useful for layouts that require edge-to-edge content.The default .container
class creates a responsive, fixed-width container that adapts based on the viewport size. It maintains specific max-widths at different breakpoints (e.g., sm
, md
, lg
, etc.).
Try it yourself
Use .container-fluid
to create a full-width container that spans the entire viewport width, regardless of screen size. This is useful for layouts that require edge-to-edge content.
Try it yourself
Bootstrap 5 introduced responsive containers that change their max-width based on the screen size breakpoint. You can use .container-{breakpoint}
to set a container width that’s fluid until it reaches the specified breakpoint.
|
≥540px |
Small ≥720px |
Medium ≥960px |
Large ≥1140px |
Extra Large ≥1320px |
---|---|---|---|---|---|
Class name |
container-sm |
container-md |
container-lg |
container-xl |
container-xxl |
Try it yourself