Margin
The margin class sets the margin property. It controls the space outside the border of an element.
value can be either one of our predefined spacing tokens (0 - 1250) or auto.
| CSS Shortcut class | Applied style | Legacy property |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Examples
All sides
m-<value>
This element has no margin on all sides.
<p class="m-0">
This element has no margin on all sides.
</p>
Top side
mt-<value>
This element lets the browser automatically calculate the margin on the top side.
<p class="mt-auto">
This element lets the browser automatically calculate the margin on the top side.
</p>
Bottom side
mb-<value>
This element has a margin of --gcds-spacing-900 on the bottom side.
<p class="mb-900">
This element has a margin of --gcds-spacing-900 on the bottom side.
</p>
Left side
ms-<value>
This element has no margin on the left side.
<p class="m-900 ms-0">
This element has no margin on the left side.
</p>
Right side
me-<value>
This element has no margin on the right side.
<p class="m-900 me-0">
This element has no margin on the right side.
</p>
Horizontal sides
mx-<value>
This element is horizontally centred by letting the browser automatically calculate the margin.
<p class="container-md mx-auto">
This element is horizontally centred by letting the browser automatically calculate the margin.
</p>
Vertical sides
my-<value>
This element has a margin of --gcds-spacing-900 on the top and bottom sides.
<p class="my-900">
This element has a margin of --gcds-spacing-900 on the top and bottom sides.
</p>
xs:> 480pxsm:> 640pxmd:> 768pxlg:> 1024pxxl:> 1280px
<div class="xs:m-300 ...">
...
</div>