Skip to main content

Layout

Containers

The outermost box that pads, centers and caps the width of your content at each breakpoint.

How they work

Containers are the most basic layout element and are required when using the default grid. A container sets a width: 100%, horizontal padding of half the gutter (.75rem each side), and margin-inline: auto to center. At each breakpoint it picks up a max-width.

Three kinds ship, unchanged from Bootstrap:

  • .container — a max-width at every breakpoint.
  • .container-{breakpoint} — width: 100% until the named breakpoint, then capped.
  • .container-fluid — width: 100% always.

The widths, which are Bootstrap's defaults:

Extra small
<576px
Small
≥576px
Medium
≥768px
Large
≥992px
X-Large
≥1200px
XX-Large
≥1400px
.container100%540px720px960px1140px1320px
.container-sm100%540px720px960px1140px1320px
.container-md100%100%720px960px1140px1320px
.container-lg100%100%100%960px1140px1320px
.container-xl100%100%100%100%1140px1320px
.container-xxl100%100%100%100%100%1320px
.container-fluid100%100%100%100%100%100%

Default container

A responsive, fixed-width container. Its max-width steps up at each breakpoint.

Main event container. Capped at 1320px on the widest screens.
HTML
<div class="container border bg-body-tertiary p-3">
  Main event container. Capped at 1320px on the widest screens.
</div>
<div class="container">
  <!-- Content here -->
</div>

Responsive containers

Responsive containers stay at width: 100% until the named breakpoint is reached, then take the max-width for that breakpoint and all the larger ones. Handy for a page that should bleed edge-to-edge on phones but settle into a column on a desk.

.container-md — full width below 768px, then capped.
HTML
<div class="container-md border bg-body-tertiary p-3">
  <code>.container-md</code> — full width below 768px, then capped.
</div>
<div class="container-sm">100% wide until small breakpoint</div>
<div class="container-md">100% wide until medium breakpoint</div>
<div class="container-lg">100% wide until large breakpoint</div>
<div class="container-xl">100% wide until extra large breakpoint</div>
<div class="container-xxl">100% wide until extra extra large breakpoint</div>

Fluid containers

Use .container-fluid for a full-width container spanning the entire viewport. The docs navbar above uses one.

Fluid — always 100% of the parent, padding on both sides.
HTML
<div class="container-fluid border bg-body-tertiary p-3">
  Fluid — always 100% of the parent, padding on both sides.
</div>
<div class="container-fluid">
  ...
</div>

Sass

The theme leaves these at Bootstrap's defaults. Override them before importing @ropebreak/bootstrap/scss/rb-bootstrap if your product wants a narrower reading column.

Variables

$container-max-widths: (
  sm: 540px,
  md: 720px,
  lg: 960px,
  xl: 1140px,
  xxl: 1320px
);

$container-padding-x: $grid-gutter-width; // 1.5rem → .75rem each side

Mixins

make-container() builds a container from a custom class. Combine it with a width if you want the max-width behaviour.

// Source mixin
@mixin make-container($padding-x: $container-padding-x) {
  width: 100%;
  padding-right: $padding-x;
  padding-left: $padding-x;
  margin-right: auto;
  margin-left: auto;
}

// Usage: a 42rem reading column for match reports
.container-report {
  @include make-container();
  max-width: 42rem;
}

Because the padding comes from --bs-gutter-x, a row placed directly inside a container cancels it with its negative margin. That is why rows live inside containers.