logo

Air CSS ver. 2.3.2

Spacing

Spacing allows to set the outer (margin) and inner (padding) space of an element. The difference between margin and padding can have a huge impact on the layout despite being invisible to the user.

Aircss spacing scale is based on the powers of two and provides eight steps.

Mnemonics

Bases
m = margin (outer)
p = padding (inner)

Modifiers
a = all

v = vertical
h = horizontal

t = top
r = right
b = bottom
l = left

0 = none

1 = 1st step in scale
2 = 2nd step in scale
3 = 3rd step in scale
4 = 4th step in scale
5 = 5th step in scale
6 = 6th step in scale
7 = 7th step in scale
8 = 8th step in scale
Optional modifiers
-m = medium
-l = large

Examples

It is possible to set the inner and outer spacing by choosing between .p* and .m* classes. However the following examples will only use outer spacing to illustrate the features of this module.

The following example shows the eight steps of the scale in the case of an horizontal margin.

left margin
.ml0
.ml1
.ml2
.ml3
.ml4
.ml5
.ml6
.ml7
.ml8
horizontal margin (left + right)
.mh0
.mh1
.mh2
.mh3
.mh4
.mh5
.mh6
.mh7
.mh8
right margin
.ml0
.ml1
.ml2
.ml3
.ml4
.ml5
.ml6
.ml7
.ml8

n.b.: The example of the 7th and 8th steps of the scale cannot be displayed efficiently on a small screen. We are sorry for the inconvenience.

The choices of priority in aircss allow to define the space for multiple edges at the same time and to override this rule with a more specific rule. As a matter of fact, a rule for all four edges can be overriden by a rule for vertical or horizontal edge and those latters overriden by an edge specific rule (top, right, bottom and left).

<div class="mh5 ml8">...</div>
.mh5 .ml8