Containers
Containers are a fundamental building block of OUDS Web that contain, pad, and align your content within a given device or viewport.
On this page
How they work
Containers are the most basic layout element in OUDS Web and are required when using our default grid system. 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.
OUDS Web provides a single responsive container, .container-fluid
, which ensures a width: 100%
at all breakpoints. To optimize its use, pair it with the .container-max-width
class. For further details, refer to the Fluid containers section.
The table below compares .container-fluid
max-width
with and without .container-max-width
across each breakpoint.
See them in action and compare them in our Grid example and Grid system example.
Please note that we apply an extra-padding on our containers (see our mixin).
2x-small <390px | X-small ≥390px | Small ≥480px | Medium ≥736px | Large ≥1024px | X-large ≥1320px | 2x-large ≥1640px | 3x-large ≥1880px | |
---|---|---|---|---|---|---|---|---|
.container-fluid with .container-max-width | 100% - (2 * 16px) | 100% - (2 * 24px) | 100% - (2 * 28px) | 100% - (2 * 32px) | 100% - (2 * 40px) | 100% - (2 * 56px) | 1520px | 1520px |
.container-fluid | 100% - (2 * 16px) | 100% - (2 * 24px) | 100% - (2 * 28px) | 100% - (2 * 32px) | 100% - (2 * 40px) | 100% - (2 * 56px) | 100% - (2 * 80px) | 100% - (2 * 112px) |
Bootstrap
$enable-bootstrap-compatibility: true
This part is enabled only when $enable-bootstrap-compatibility
is set to true
. Read more
about Bootstrap compatibility.
These containers should not be used for Orange websites. Instead, use the containers provided by OUDS Web: .container-fluid
associated or not with .container-max-width
.
Bootstrap compatibility enables the use of three different containers:
.container
, which sets a staticmax-width
between each responsive breakpoint..container-{breakpoint}
, which follow the.container-fluid
behavior until the specified breakpoint, then it follows the.container
one..container-fluid
, which sets thewidth: 100%
at all breakpoints.
Moreover, Bootstrap compatibility includes the support for xxl breakpoint, defined like 2xl, making .container-xxl
class available.
The table below illustrates how each container’s max-width
compares to the original .container
and .container-fluid
across each breakpoint.
Please note that we apply an extra-padding on our containers (see our mixin).
2x-small <390px | X-small ≥390px | Small ≥480px | Medium ≥736px | Large ≥1024px | X-large ≥1320px | 2x-large ≥1640px | 3x-large ≥1880px | |
---|---|---|---|---|---|---|---|---|
.container | 100% - (2 * 16px) | 342px | 424px | 672px | 944px | 1208px | 1480px | 1656px |
.container-xs | 100% - (2 * 16px) | 342px | 424px | 672px | 944px | 1208px | 1480px | 1656px |
.container-sm | 100% - (2 * 16px) | 100% - (2 * 24px) | 424px | 672px | 944px | 1208px | 1480px | 1656px |
.container-md | 100% - (2 * 16px) | 100% - (2 * 24px) | 100% - (2 * 28px) | 672px | 944px | 1208px | 1480px | 1656px |
.container-lg | 100% - (2 * 16px) | 100% - (2 * 24px) | 100% - (2 * 28px) | 100% - (2 * 32px) | 944px | 1208px | 1480px | 1656px |
.container-xl | 100% - (2 * 16px) | 100% - (2 * 24px) | 100% - (2 * 28px) | 100% - (2 * 32px) | 100% - (2 * 40px) | 1208px | 1480px | 1656px |
.container-2xl | 100% - (2 * 16px) | 100% - (2 * 24px) | 100% - (2 * 28px) | 100% - (2 * 32px) | 100% - (2 * 40px) | 100% - (2 * 56px) | 1480px | 1656px |
.container-xxl | 100% - (2 * 16px) | 100% - (2 * 24px) | 100% - (2 * 28px) | 100% - (2 * 32px) | 100% - (2 * 40px) | 100% - (2 * 56px) | 1480px | 1656px |
.container-3xl | 100% - (2 * 16px) | 100% - (2 * 24px) | 100% - (2 * 28px) | 100% - (2 * 32px) | 100% - (2 * 40px) | 100% - (2 * 56px) | 100% - (2 * 80px) | 1656px |
.container-fluid | 100% - (2 * 16px) | 100% - (2 * 24px) | 100% - (2 * 28px) | 100% - (2 * 32px) | 100% - (2 * 40px) | 100% - (2 * 56px) | 100% - (2 * 80px) | 100% - (2 * 112px) |
Default container
Our default .container
class is a responsive, fixed-width container, meaning its max-width
changes at each breakpoint.
This container should not be used for Orange websites.
<div class="container-fluid">
<!-- Content here -->
</div>
Responsive containers
Responsive containers allow you to specify a class that follows the .container-fluid
behavior until the specified breakpoint is reached, after which we apply max-width
s for each of the higher breakpoints. For example, .container-sm
behaves like the .container-fluid
to start until the sm
breakpoint is reached, where it will scale up with md
, lg
, xl
, 2xl
, xxl
and 3xl
.
<div class="container-xs">100% wide until x-small breakpoint</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 x-large breakpoint</div>
<div class="container-2xl">100% wide until 2x-large breakpoint</div>
<div class="container-xxl">100% wide until 2x-large breakpoint</div>
<div class="container-3xl">100% wide until 3x-large breakpoint</div>
Fluid containers
Use .container-fluid
for a full width container with minimum margins, spanning almost the entire width of the viewport.
<div class="container-fluid">
...
</div>
Default max width
This container should be associated by default with the class .container-max-width
. After breakpoint 2xl
, this class:
- limits the container width to 1680px (including margins),
- limits container margin to 80px each side,
- limits gutters width to 32px.
It is defined as follows:
.container-max-width {
@include media-breakpoint-up(get-breakpoint-from-width()) {
--#{$prefix}container-margin-x: #{map-get($container-fluid-margin, get-breakpoint-from-width())};
max-width: $ouds-grid-2xl-max-width-alt;
.row {
--#{$prefix}gutter-x: #{map-get($grid-gutter-widths, get-breakpoint-from-width())};
}
}
}
Comparison between .container-fluid
with .container-max-width
and .container-fluid
alone can be seen in the following table:
X-large ≥1320px | 2x-large ≥1640px | 3x-large ≥1880px | |
---|---|---|---|
.container-fluid with .container-max-width |
|
|
|
.container-fluid |
|
|
|