--- title: Container layout: docs theme: library fullwidth: true hide_categories: true doc-tab: layout doc-subtab: container breadcrumb: - home - documentation - layout - layout-container meta: colors: false sizes: true variables: true hide_css_vars: true --- {% capture container_example %}
This container is centered on desktop and larger viewports.
{% 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 %} {% capture container_max_tablet_example %}
This container has a max-width of $tablet - $container-offset.
{% endcapture %} {% capture container_max_desktop_example %}
This container has a max-width of $desktop - $container-offset on widescreen and fullhd.
{% endcapture %} {% capture container_max_widescreen_example %}
This container has a max-width of $widescreen - $container-offset on fullhd.
{% endcapture %} {% assign bp_tablet = site.data.breakpoints.tablet %} {% assign bp_desktop = site.data.breakpoints.desktop %} {% assign bp_widescreen = site.data.breakpoints.widescreen %} {% assign bp_fullhd = site.data.breakpoints.fullhd %} {% assign container_offset = 64 %} {% capture thead %} {% for breakpoint_hash in site.data.breakpoints %} {% assign breakpoint = breakpoint_hash[1] %} {% if breakpoint.id == 'tablet' %} Below
{{ bp_tablet.to }}px {% elsif breakpoint.id != 'mobile' %} {{ breakpoint.name }}
{% if breakpoint.id == 'fullhd' %} {{ breakpoint.from }}px and above {% else %} Between {{ breakpoint.from }}px and {{ breakpoint.to }}px {% endif %} {% endif %} {% endfor %} {% endcapture %}

The container is a simple utility element that allows you to center content on larger viewports. It can be used in any context, but mostly as a direct child of one of the following:

{% include docs/elements/anchor.html name="Overview" %}
{{ thead }}
Class max-width
.container Full width {{ bp_desktop.from | minus: container_offset }}px {{ bp_widescreen.from | minus: container_offset }}px {{ bp_fullhd.from | minus: container_offset }}px
.container.is-widescreen Full width {{ bp_widescreen.from | minus: container_offset }}px {{ bp_fullhd.from | minus: container_offset }}px
.container.is-fullhd Full width {{ bp_fullhd.from | minus: container_offset }}px
.container.is-max-desktop Full width {{ bp_desktop.from | minus: container_offset }}px
.container.is-max-widescreen Full width {{ bp_desktop.from | minus: container_offset }}px {{ bp_widescreen.from | minus: container_offset }}px
{% include docs/elements/anchor.html name="Default behavior" %}

By default, the container will only be activated from the $desktop breakpoint. It will increase its max-width after reaching the $widescreen and $fullhd breakpoints.

The container's 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.

{{ container_example }}
{% highlight html -%} {{- container_example -}} {%- endhighlight %} {% include docs/elements/anchor.html name="Widescreen or FullHD only" %}

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

{{ container_widescreen_example }}
{% highlight html -%} {{- container_widescreen_example -}} {%- endhighlight %}
{{ container_fullhd_example }}
{% highlight html -%} {{- container_fullhd_example -}} {%- endhighlight %} {% include docs/elements/anchor.html name="Tablet, Desktop and Widescreen maximum widths" %}

Sometimes, you might want a narrow container on larger viewports. That's why Bulma provides 3 modifier classes:

{{ container_max_tablet_example }}
{% highlight html -%} {{- container_max_tablet_example -}} {%- endhighlight %}
{{ container_max_desktop_example }}
{% highlight html -%} {{- container_max_desktop_example -}} {%- endhighlight %}
{{ container_max_widescreen_example }}
{% highlight html -%} {{- container_max_widescreen_example -}} {%- endhighlight %} {% include docs/elements/anchor.html name="Absolute maximum width" %}

If you want to change the maximum width of all containers, you can do so by updating the values of the $container-max-width Sass variable.

By default, the $fullhd breakpoint value is used to calculate the absolute maximum width of the container. Simply change it to a smaller value like $widescreen, $desktop, or any value in pixels.

{% include docs/elements/anchor.html name="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:

{{ container_fluid_example }}
{% highlight html -%} {{- container_fluid_example -}} {%- endhighlight %}