--- title: Responsive Mixins layout: documentation doc-tab: utilities doc-subtab: responsive-mixins fullmain: true breadcrumb: - home - documentation - utilities - utilities-responsive-mixins ---

Bulma is responsive by default. Learn more about Bulma's responsiveness.

{% include elements/anchor.html name="from() and until() mixins" %}

Responsiveness in CSS is based on media queries (see MDN documentation).

Bulma provides 2 useful responsive mixins:

Their usage is very simple:

{% include elements/anchor-bis.html name="from()" %}

The from() mixin has a single parameter which sets the screen width from which the styles it contains will be applied:

Sass source

{% highlight sass %}.my-element { background: red; @include from(1280px) { background: blue; } }{% endhighlight %}

CSS output

{% highlight css %}.my-element { background: red; } @media screen and (min-width: 1280px) { .my-element { background: blue; } }{% endhighlight %}

For screens with a width of 1279px or less, the element's background will be red.
For screens 1280px-wide or more, the element's background will be blue.

{% include elements/anchor-bis.html name="until()" %}

The until() mixin has a single parameter which sets the screen width (minus 1px) until which the styles it contains will be applied.

This means that if you set a value of 1280px, the styles will be applied on a screen width of 1279px but not on a screen width of 1280px.

The reason for this 1px offset is to allow you to use both from() and until() with the same breakpoint value. This leaves no gap between the 2 sets of rules.

Sass source

{% highlight sass %}$breakpoint: 1280px; .my-element { @include until($breakpoint) { background: green; } @include from($breakpoint) { background: orange; } }{% endhighlight %}

CSS output

{% highlight css %}@media screen and (max-width: 1279px) { .my-element { background: green; } } @media screen and (min-width: 1280px) { .my-element { background: orange; } }{% endhighlight %}

For screens with a width of 1279px or less, the element's background will be green.
For screens 1280px-wide or more, the element's background will be orange.

{% include elements/anchor.html name="Named mixins" %}

By having 4 breakpoints and supporting 5 screen sizes, Bulma can support a lot of different setups.

While you could use the mixins {% include elements/snippet-inline.html content="@include from()" %} and {% include elements/snippet-inline.html content="@include until()" %}, Bulma provides quick shortcuts with 11 named mixins.

These responsive mixins are named after the screen sizes and breakpoints used in Bulma, so that you can use them to create a responsive designs:

{% capture inc-mobile %} @include mobile { // Styles applied // below $tablet } {% endcapture %} {% capture inc-tablet %} @include tablet { // Styles applied // above $tablet } {% endcapture %} {% capture inc-tablet-only %} @include tablet-only { // Styles applied // between $tablet // and $desktop } {% endcapture %} {% capture inc-desktop-only %} @include desktop-only { // Styles applied // between $desktop // and $widescreen } {% endcapture %} {% capture inc-widescreen-only %} @include widescreen-only { // Styles applied // between $widescreen // and $fullhd } {% endcapture %} {% capture inc-desktop %} @include desktop { // Styles applied // above $desktop } {% endcapture %} {% capture inc-widescreen %} @include widescreen { // Styles applied // above $widescreen } {% endcapture %} {% capture inc-fullhd %} @include fullhd { // Styles applied // above $fullhd } {% endcapture %} {% capture inc-touch %} @include touch { // Styles applied // below $desktop } {% endcapture %} {% capture inc-until-widescreen %} @include until-widescreen { // Styles applied // below $widescreen } {% endcapture %} {% capture inc-until-fullhd %} @include until { // Styles applied // below $fullhd } {% endcapture %}
{% for breakpoint_hash in site.data.breakpoints %} {% assign breakpoint = breakpoint_hash[1] %} {% endfor %}
{{ breakpoint.name }}
{% if breakpoint.id == 'mobile' %} Up to {{ breakpoint.to }}px {% elsif breakpoint.id == 'fullhd' %} {{ breakpoint.from }}px and above {% else %} Between {{ breakpoint.from }}px and {{ breakpoint.to }}px {% endif %}
{% highlight sass %}{{ inc-mobile }}{% endhighlight %}

-

-

{% highlight sass %}{{ inc-tablet }}{% endhighlight %}

-

{% highlight sass %}{{ inc-desktop }}{% endhighlight %}

-

{% highlight sass %}{{ inc-widescreen }}{% endhighlight %}

-

{% highlight sass %}{{ inc-fullhd }}{% endhighlight %}

-

{% highlight sass %}{{ inc-tablet-only }}{% endhighlight %}

-

-

{% highlight sass %}{{ inc-desktop-only }}{% endhighlight %}

-

-

{% highlight sass %}{{ inc-widescreen-only }}{% endhighlight %}

-

{% highlight sass %}{{ inc-touch }}{% endhighlight %}

-

{% highlight sass %}{{ inc-until-widescreen }}{% endhighlight %}

-

{% highlight sass %}{{ inc-until-fullhd }}{% endhighlight %}

-

{% assign or_link = site.data.links.by_id['overview-responsiveness'] %}

Learn more about Bulma responsiveness.