--- title: Container subtitle: "A simple container to center your content horizontally" layout: documentation hide_carbon: true doc-tab: layout doc-subtab: container --- {% capture container_example %}
This container is centered on desktop.
{% endcapture %} {% capture container_fluid_example %}
This container is fluid: it will have a 32px gap on either side, on any viewport size.
{% endcapture %} {% capture container_widescreen_example %}
This container is fullwidth until the $widescreen breakpoint.
{% endcapture %} {% capture container_fullhd_example %}
This container is fullwidth until the $fullhd breakpoint.
{% endcapture %}

The .container class can be used in any context, but mostly as a direct child of either:

The containers width for each breakpoint is the result of: $device - (2 * $gap). The $gap variable has a default value of 32px but can be modified.

This is how the container will behave:

The values 960, 1152 and 1344 have been chosen because they are divisible by both 12 and 16.

{% include layout/main-close.html show_carbon=true %}
{{container_example}}
{% include layout/main-open.html %} {% highlight html %}{{ container_example }}{% endhighlight %}

Fluid container

If you don't want to have a maximum width but want to keep the 32px margin on the left and right sides, add the is-fluid modifier:

{% include layout/main-close.html %}
{{container_fluid_example}}
{% include layout/main-open.html %} {% highlight html %}{{ container_fluid_example }}{% endhighlight %}

Breakpoint containers

With the two modifiers .is-widescreen and .is-fullhd, you can have a fullwidth container until those specific breakpoints.

{% include layout/main-close.html %}
{{container_widescreen_example}}
{% include layout/main-open.html %} {% highlight html %}{{ container_widescreen_example }}{% endhighlight %} {% include layout/main-close.html %}
{{ container_fullhd_example }}
{% include layout/main-open.html %} {% highlight html %}{{ container_fullhd_example }}{% endhighlight %}