Spacing
Control margin, padding and gap with a consistent spacing scale so layouts stay rhythmic across the whole product.
The spacing scale
Spacing utilities share a single numeric scale. The suffix is a step on the scale — not a pixel value — which keeps spacing proportional and predictable. The scale is non-linear: it tightens at the low end for fine control and widens at the top for section-level breathing room.
| Step | rem | px (at 16px root) |
|---|---|---|
0 | 0 | 0px |
1 | 0.25rem | 4px |
2 | 0.5rem | 8px |
3 | 0.75rem | 12px |
4 | 1rem | 16px |
5 | 1.25rem | 20px |
6 | 1.5rem | 24px |
8 | 2rem | 32px |
10 | 2.5rem | 40px |
12 | 3rem | 48px |
16 | 4rem | 64px |
Notation
Every spacing class follows the pattern .bima-{property}{side}-{step}. The property is m for margin or p for padding. The optional side narrows the effect to specific edges.
| Side | Edges affected |
|---|---|
| (none) | All four edges. |
t | Top. |
b | Bottom. |
s | Start — left in LTR, right in RTL. |
e | End — right in LTR, left in RTL. |
x | Horizontal (start and end). |
y | Vertical (top and bottom). |
The s (start) and e (end) sides are logical properties: they automatically flip for right-to-left languages, so use them in preference to physical left/right wherever possible.
Padding
Padding adds space inside an element, between its border and its content. Use .bima-p-* for all sides, or scope it with .bima-pt-*, .bima-pb-*, .bima-ps-*, .bima-pe-*, .bima-px-* and .bima-py-*. The coloured boxes below have a tinted background so the padding shows up as inner whitespace.
<div class="bima-p-2">…</div> <div class="bima-p-4">…</div> <div class="bima-p-6">…</div> <div class="bima-px-8 bima-py-2">…</div>
Margin
Margin adds space outside an element, pushing neighbours away. Use .bima-m-* for all sides, or the side-scoped variants .bima-mt-*, .bima-mb-*, .bima-ms-*, .bima-me-*, .bima-mx-* and .bima-my-*. Below, each blue box carries a start margin, so the gap before it grows with the step.
<div class="bima-ms-0">…</div> <div class="bima-ms-4">…</div> <div class="bima-ms-8">…</div> <div class="bima-ms-12">…</div>
Horizontal centring
Use .bima-mx-auto to centre a block-level element of a fixed or constrained width inside its parent by distributing the leftover horizontal space evenly.
<div class="bima-w-50 bima-mx-auto">Centred block</div>
Gap
The .bima-gap-* utilities set the gap between children of a flex or grid container. Because gap only applies to spacing between items (never the outer edges), it is the cleanest way to space rows and columns. Pair it with .bima-d-flex or .bima-d-grid.
<div class="bima-d-flex bima-gap-4"> <div>…</div> <div>…</div> </div>
Gap is available in steps 1, 2, 3, 4, 5, 6 and 8.
Class reference
| Pattern | Property | Example |
|---|---|---|
.bima-m-{step} | margin (all) | .bima-m-4 |
.bima-mt-{step} | margin-top | .bima-mt-2 |
.bima-mb-{step} | margin-bottom | .bima-mb-6 |
.bima-ms-{step} | margin-inline-start | .bima-ms-3 |
.bima-me-{step} | margin-inline-end | .bima-me-3 |
.bima-mx-{step} | margin-inline | .bima-mx-8 |
.bima-my-{step} | margin-block | .bima-my-8 |
.bima-mx-auto | margin-inline: auto | .bima-mx-auto |
.bima-p-{step} | padding (all) | .bima-p-4 |
.bima-pt-{step} | padding-top | .bima-pt-2 |
.bima-pb-{step} | padding-bottom | .bima-pb-6 |
.bima-ps-{step} | padding-inline-start | .bima-ps-3 |
.bima-pe-{step} | padding-inline-end | .bima-pe-3 |
.bima-px-{step} | padding-inline | .bima-px-8 |
.bima-py-{step} | padding-block | .bima-py-8 |
.bima-gap-{step} | gap (1–6, 8) | .bima-gap-4 |