Skip to content
Related Articles
Open in App
Not now

Related Articles

Bulma Spacing

Improve Article
Save Article
  • Last Updated : 21 Jun, 2022
Improve Article
Save Article

Bulma has many facilities of classes to easily style elements in HTML. It includes various responsive padding and margin classes for modification of the appearance of elements. Spacing utilities have no breakpoints symbols to apply to the breakpoints.

Following syntax are used in the various classes for adding spacing.

  • (property)(sides)-(size) for xs
  • (property)(sides)-(breakpoint)-(size) for sm, md, lg, and xl.

Property: There are two ways of adding spacing to the elements.

  •   m: This property defines the margin. Margin provides an edge or border.
  •   p: This property defines the padding. Padding properties are used to generate space around the content.

Configuration Sides: This allows users to add spacing in content to a specific side wherever required.

  • t : margin-top/padding-top.
  • b : margin-bottom/padding-bottom.
  • l : margin-left/padding-left.
  • r : margin-right/padding-right.
  • x : for padding-left and padding-right/margin-left and margin-right.
  • y : for padding-top and padding-bottom/margin-top and margin-bottom.
  • blank : margin/padding on all sides of the element.

List of all Size: This allows users to add a specific amount of spacing to a level.

  • 0 – 0rem margin/padding.
  • 1 – 0.25rem margin/padding.
  • 2 – 0.5rem margin/padding.
  • 3 – 0.75rem margin/padding.
  • 4 – 1rem margin/padding.
  • 5 – 1.5rem margin/padding.
  • 6 – 3rem margin/padding.
  • auto – auto margin.

Breakpoint: Breakpoints are points where the website content can adjust according to the device and allow to show the best layout to the user.  

Example1:

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>Bulma Panel</title>
 
    <link rel='stylesheet' href=
     
    <style>
        p {
            border: 2px solid green;
        }
    </style>
</head>
 
<body>
    <h1 class="is-size-2">
        GeeksforGeeks
    </h1>
     
    <b>Bulma Space Class</b>
    <br>
     
    <div class="container">
        <p class="mr-0 pt-3 has-text-light
                has-background-success">
            GeeksforGeeks
        </p>
 
 
        <br>
        <p class="ml-5 has-text-light
                has-background-success">
            GeeksforGeeks
        </p>
 
 
        <br>
        <p class="pb-5 has-text-light
                has-background-success">
            GeeksforGeeks
        </p>
 
    </div>
</body>
 
</html>


Output:

Bulma Space Class

Example2: In the below code, we will make use of the ml and mr classes.

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>Bulma Panel</title>
 
    <link rel='stylesheet' href=
     
    <style>
        p {
            border: 2px solid green;
        }
    </style>
</head>
 
<body>
    <center>
    <h1 class="is-size-2">
        GeeksforGeeks
    </h1>
     
    <b>Bulma Space Class</b>
    <br>
     
    <div class="container">
        <p class="ml-1 mr-1 has-text-light
                has-background-success">
            GeeksforGeeks
        </p>
 
 
        <br>
        <p class="ml-2 mr-2 has-text-light
                has-background-success">
            GeeksforGeeks
        </p>
<br>
        <p class="ml-3 mr-3 has-text-light
                has-background-success">
            GeeksforGeeks
        </p>
<br>
        <p class="ml-4 mr-4 has-text-light
                has-background-success">
            GeeksforGeeks
        </p>
<br>
        <p class="ml-5 mr-5 has-text-light
                has-background-success">
            GeeksforGeeks
        </p>
 
    </div>
    </center>
</body>
 
</html>


Output:

 


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!