--- title: Bulma Sass Responsive Mixins layout: docs theme: sass doc-tab: sass doc-subtab: responsive-mixins breadcrumb: - home - documentation - sass - sass-responsive-mixins ---

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

{% include docs/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 docs/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 %}@use "bulma/sass/utilities/mixins"; .my-element { background: red; @include mixins.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 docs/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 %}@use "bulma/sass/utilities/mixins"; $breakpoint: 1280px; .my-element { @include mixins.until($breakpoint) { background: green; } @include mixins.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 docs/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 docs/elements/snippet-inline.html content="@include mixins.from()" %} and {% include docs/elements/snippet-inline.html content="@include mixins.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 %} @use "bulma/sass/utilities/mixins"; @include mixins.mobile { // Styles applied // below $tablet } {% endcapture %} {% capture inc-tablet %} @use "bulma/sass/utilities/mixins"; @include mixins.tablet { // Styles applied // above $tablet } {% endcapture %} {% capture inc-tablet-only %} @use "bulma/sass/utilities/mixins"; @include mixins.tablet-only { // Styles applied // between $tablet // and $desktop } {% endcapture %} {% capture inc-desktop-only %} @use "bulma/sass/utilities/mixins"; @include mixins.desktop-only { // Styles applied // between $desktop // and $widescreen } {% endcapture %} {% capture inc-widescreen-only %} @use "bulma/sass/utilities/mixins"; @include mixins.widescreen-only { // Styles applied // between $widescreen // and $fullhd } {% endcapture %} {% capture inc-desktop %} @use "bulma/sass/utilities/mixins"; @include mixins.desktop { // Styles applied // above $desktop } {% endcapture %} {% capture inc-widescreen %} @use "bulma/sass/utilities/mixins"; @include mixins.widescreen { // Styles applied // above $widescreen } {% endcapture %} {% capture inc-fullhd %} @use "bulma/sass/utilities/mixins"; @include mixins.fullhd { // Styles applied // above $fullhd } {% endcapture %} {% capture inc-touch %} @use "bulma/sass/utilities/mixins"; @include mixins.touch { // Styles applied // below $desktop } {% endcapture %} {% capture inc-until-widescreen %} @use "bulma/sass/utilities/mixins"; @include mixins.until-widescreen { // Styles applied // below $widescreen } {% endcapture %} {% capture inc-until-fullhd %} @use "bulma/sass/utilities/mixins"; @include mixins.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.