Spacing
The Spacing Utilities extend Bootstrap by introducing highly flexible margin and padding classes, based on your custom rem-based $spacing scale. Responsive variants and RTL logical spacing are fully supported.
All classes use the al- prefix and follow utility-first conventions.
Overview
| Utility Type | Class Format | Description |
|---|---|---|
| Padding | .al-p{side}-{value} | Apply padding in rem |
| Margin | .al-m{side}-{value} | Apply margin in rem |
| Negative Margin | .al-m{side}-n-{value} | Negative margin |
| Logical Padding | .al-ps-{value}, .al-pe-{value} | Logical RTL padding |
| Logical Margin | .al-ms-{value}, .al-me-{value} | Logical RTL margin |
| Responsive Padding | .al-p{side}-{breakpoint}-{value} | Responsive padding |
| Responsive Margin | .al-m{side}-{breakpoint}-{value} | Responsive margin |
Sass Reference
$spacing: (
1: 0.063,
2: 0.125,
3: 0.188,
4: 0.25,
5: 0.313,
6: 0.375,
7: 0.438,
8: 0.5,
9: 0.563,
10: 0.625,
12: 0.75,
16: 1,
18: 1.125,
20: 1.25,
22: 1.375,
24: 1.5,
25: 1.563,
26: 1.625,
28: 1.75,
30: 1.875,
32: 2,
35: 2.188,
36: 2.25,
40: 2.5,
45: 2.813,
48: 3,
50: 3.125,
55: 3.438,
56: 3.5,
60: 3.75,
64: 4,
65: 4.063,
70: 4.375,
75: 4.688,
80: 5,
85: 5.313,
90: 5.625,
95: 5.938,
100: 6.25,
110: 6.875,
120: 7.5,
130: 8.125,
140: 8.75,
150: 9.375,
170: 10.625,
190: 11.875,
200: 12.5,
250: 15.625,
300: 18.75
);
Responsive Breakpoints
| Breakpoint | Media Query | Class Format |
|---|---|---|
| sm | min-width: 575px | .al-pt-sm-16 |
| md | min-width: 768px | .al-mx-md-40 |
| lg | min-width: 992px | .al-py-lg-24 |
| xl | min-width: 1200px | .al-mt-xl-50 |
| xxl | min-width: 1400px | .al-pb-xxl-75 |
Examples
Padding
Margin
Negative Margin
Responsive Spacing
Developer Notes
-
$spacing: defines rem values for margin, and padding
-
All utilities are built using Sass loops for scalability and consistency
-
All utilities use !important for priority over Bootstrap defaults
-
Fully responsive and consistent with Bootstrap's grid system