--- title: Spacing helpers layout: documentation doc-tab: helpers doc-subtab: helpers-spacing breadcrumb: - home - documentation - helpers - helpers-spacing shortcuts: margin: m padding: p directions: all: a top: t right: r bottom: b left: l horizontal: x vertical: y values: 0: 0 1: 0.25rem 2: 0.5rem 3: 0.75rem 4: 1rem 5: 1.5rem 6: 3rem customShortcuts: margin: mg customHorizontal: h customValues: small: 10px medium: 30px large: 60px --- {% include elements/new-tag.html version="0.9.0" %}

Bulma provides margin m* and padding p* helpers in all directions:

You need to combine a margin/padding prefix with a direction suffix. For example:

Each of these property-direction combinations needs to be appended with one of 6 value suffixes:

Suffix Value
*-00
*-10.25rem
*-20.5rem
*-30.75rem
*-41rem
*-51.5rem
*-63rem
{% include elements/anchor.html name="List of all spacing helpers" %}

There are 84 spacing helpers to choose from:

{% include components/spacing-table.html values=page.values shortcuts=page.shortcuts directions=page.directions horizontal=page.horizontal vertical=page.vertical %}

To use these classes, simply append them to any HTML element:

{% highlight html %}

Margin bottom

Horizontal padding

Both

{% endhighlight %} {% include elements/anchor.html name="Configuration" %} {% capture custom %} $spacing-shortcuts: ("margin": "mg"); $spacing-horizontal: "h"; $spacing-vertical: null; $spacing-values: ("small": 10px, "medium": 30px, "large": 60px); {% endcapture %}

Because every developer has their own preferences, and to satisfy Bulma's customization features, it's possible to specify your own class name shortcuts as well as the spacing values.

For example, if you wanted:

You can simplify the CSS output by customizing these SCSS variables:

{% highlight scss %}{{ custom }}{% endhighlight %} {% include components/spacing-table.html values=page.customValues shortcuts=page.customShortcuts directions=page.directions horizontal=page.customHorizontal %}

By customizing the output, you've narrowed down the list of spacing helpers from 84 to only 15.