Spacing
Notation #
Spacing utility classes can be defined using the format -{property}{sides}[-{breakpoint}]--{size}.
{property} #
- m- use to apply- margin
- p- use to apply- padding
{sides} #
- t- use to apply- margin-topor- padding-top
- b- use to apply- margin-bottomor- padding-bottom
- l- use to apply- margin-leftor- padding-left
- r- use to apply- margin-rightor- padding-right
- x- use to apply- margin-leftand- margin-rightor- padding-leftand- padding-right
- y- use to apply- margin-topand- margin-bottomor- padding-topand- padding-bottom
- blank - leave blank to apply marginorpaddingto all 4 sides.
{breakpoint} #
Optionally, include -{breakpoint} to apply the utility behaviour to some breakpoints. As a mobile-first library, any applying to smaller breakpoints will also modify larger ones unless another class overrides this behaviour.
- blank - leave blank to apply marginorpaddingto all breakpoints.
- sm- use to apply- marginor- paddingto sm and larger breakpoints.
- md- use to apply- marginor- paddingto md and larger breakpoints.
- lg- use to apply- marginor- paddingto lg and larger breakpoints.
- xl- use to apply- marginor- paddingto xl breakpoints.
{size} #
- 0- use to eliminate existing- marginor- paddingand set to- 0
- 1- use to set- marginor- paddingto- $base-unit
- 2- use to set- marginor- paddingto- $base-unit * 2
- 3- use to set- marginor- paddingto- $base-unit * 3
- 4- use to set- marginor- paddingto- $base-unit * 4
- 5- use to set- marginor- paddingto- $base-unit * 5
- 6- use to set- marginor- paddingto- $base-unit * 6
- 7- use to set- marginor- paddingto- $base-unit * 7
- 8- use to set- marginor- paddingto- $base-unit * 8
- 9- use to set- marginor- paddingto- $base-unit * 9
- 10- use to set- marginor- paddingto- $base-unit * 10
- auto- use to set- marginto- autovalue
Examples #
Margins #
In this example, various margin classes have been applied to render margin on all 4 sides of the blue squares. The margin can be visualized in blue.
Side Margins #
Apply margin to specific sides of an element by adding t,
b, l, r, x or y
to the class name.
Padding #
In this example, various padding classes have been applied to render padding on all 4 sides of the blue squares. The padding can be visualized in yellow.
Side Paddings #
Apply padding to specific sides of an element by adding t,
b, l, r, x or y
to the class name.