Spacing
Spacing System
System Overview
Spacing systems, grids, and layouts provide a series of rules and guidelines that give the interface a consistent rhythm. We have developed a class system for controlling margin and padding within the interface. These classes form a scale that serves to help you when placing elements onto a page.
The system comes with 12 sizes in total (counting 0 and auto) ranging from XXS to 5XL for both margin and padding. Margin has a unique set of sizes called auto, which sets the value of given margin direction to auto. Padding does not support this functionality.
Each property (margin & padding) is broken up into smaller properties:
- m, p - all
- mt, pt - top
- mb, pb - bottom
- ml, pl - left
- mr, pr - right
- mx, px - horizontal (left and right)
- my, py - vertical (top and bottom)
Margin & Padding
Margin
In CSS, margin properties are used to create space outside of elements. This means that when you apply margin to an element, it will apply it on the furthest edges of the element, outside of any defined borders.
You have full control over setting margins for each side of an element (top, right, bottom, and left).
- margin
- margin-top
- margin-right
- margin-bottom
- margin-left
In addition to this, margin properties can have the following values:
- auto - browser calculates margin
- length - specifies a margin in units (we use rem units)
Note: Negative values for margin are allowed but there are no spacing classes with built-in functionality at the moment. If demand is needed, there will be future additions which add this functionality.
Padding
In CSS, padding properties are used to create space around an element's content. This means that when you apply margin to an element, it will apply it on the closest edges of the element's content, inside of any defined borders.
You have full control over setting paddings for each side of an element (top, right, bottom, and left).
- padding
- padding-top
- padding-right
- padding-bottom
- padding-left
In addition to this, margin properties can have the following values:
- length - specifies a margin in units (we use rem units)
Note: Negative values for padding are not allowed.
Margin Sizes
margin-right: 0;
margin-bottom: 0;
margin-right: 0.5rem; /* 8px */
margin-bottom: 0.5rem; /* 8px */
margin-right: 0.75rem; /* 12px */
margin-bottom: 0.75rem; /* 12px */
margin-right: 1rem; /* 16px */
margin-bottom: 1rem; /* 16px */
margin: 1.5rem; /* 24px */
/* Mobile */
margin: 1.25rem; /* 20px */
margin-left: 1.5rem; /* 24px */
margin-right: 1.5rem; /* 24px */
/* Mobile */
margin-left: 1.25rem; /* 20px */
margin-right: 1.25rem; /* 20px */
margin-top: 1.5rem; /* 24px */
margin-bottom: 1.5rem; /* 24px */
/* Mobile */
margin-top: 1.25rem; /* 20px */
margin-bottom: 1.25rem; /* 20px */
margin-top: 1.5rem; /* 24px */
/* Mobile */
margin-top: 1.25rem; /* 20px */
margin-right: 1.5rem; /* 24px */
/* Mobile */
margin-right: 1.25rem; /* 20px */
margin-bottom: 1.5rem; /* 24px */
/* Mobile */
margin-bottom: 1.25rem; /* 20px */
margin-left: 1.5rem; /* 24px */
/* Mobile */
margin-left: 1.25rem; /* 20px */
margin: 2rem; /* 32px */
/* Mobile */
margin: 1.5rem; /* 24px */
margin-left: 2rem; /* 32px */
margin-right: 2rem; /* 32px */
/* Mobile */
margin-left: 1.5rem; /* 24px */
margin-right: 1.5rem; /* 24px */
margin-top: 2rem; /* 32px */
margin-bottom: 2rem; /* 32px */
/* Mobile */
margin-top: 1.5rem; /* 24px */
margin-bottom: 1.5rem; /* 24px */
margin-top: 2rem; /* 32px */
/* Mobile */
margin-top: 1.5rem; /* 24px */
margin-right: 2rem; /* 32px */
/* Mobile */
margin-right: 1.5rem; /* 24px */
margin-bottom: 2rem; /* 32px */
/* Mobile */
margin-bottom: 1.5rem; /* 24px */
margin-left: 2rem; /* 32px */
/* Mobile */
margin-left: 1.5rem; /* 24px */
margin: 3rem; /* 48px */
/* Mobile */
margin: 1.75rem; /* 28px */
margin-left: 3rem; /* 48px */
margin-right: 3rem; /* 48px */
/* Mobile */
margin-left: 1.75rem; /* 28px */
margin-right: 1.75rem; /* 28px */
margin-top: 3rem; /* 48px */
margin-bottom: 3rem; /* 48px */
/* Mobile */
margin-top: 1.75rem; /* 28px */
margin-bottom: 1.75rem; /* 28px */
margin-top: 3rem; /* 48px */
/* Mobile */
margin-top: 1.75rem; /* 28px */
margin-right: 3rem; /* 48px */
/* Mobile */
margin-right: 1.75rem; /* 28px */
margin-bottom: 3rem; /* 48px */
/* Mobile */
margin-bottom: 1.75rem; /* 28px */
margin-left: 3rem; /* 48px */
/* Mobile */
margin-left: 1.75rem; /* 28px */
margin: 4rem; /* 64px */
/* Mobile */
margin: 2.5rem; /* 40px */
margin-left: 4rem; /* 64px */
margin-right: 4rem; /* 64px */
/* Mobile */
margin-left: 2.5rem; /* 40px */
margin-right: 2.5rem; /* 40px */
margin-top: 4rem; /* 64px */
margin-bottom: 4rem; /* 64px */
/* Mobile */
margin-top: 2.5rem; /* 40px */
margin-bottom: 2.5rem; /* 40px */
margin-top: 4rem; /* 64px */
/* Mobile */
margin-top: 2.5rem; /* 40px */
margin-right: 4rem; /* 64px */
/* Mobile */
margin-right: 2.5rem; /* 40px */
margin-bottom: 4rem; /* 64px */
/* Mobile */
margin-bottom: 2.5rem; /* 40px */
margin-left: 4rem; /* 64px */
/* Mobile */
margin-left: 2.5rem; /* 40px */
margin: 6rem; /* 96px */
/* Mobile */
margin: 3.5rem; /* 56px */
margin-left: 6rem; /* 96px */
margin-right: 6rem; /* 96px */
/* Mobile */
margin-left: 3.5rem; /* 56px */
margin-right: 3.5rem; /* 56px */
margin-top: 6rem; /* 96px */
margin-bottom: 6rem; /* 96px */
/* Mobile */
margin-top: 3.5rem; /* 56px */
margin-bottom: 3.5rem; /* 56px */
margin-top: 6rem; /* 96px */
/* Mobile */
margin-top: 3.5rem; /* 56px */
margin-right: 6rem; /* 96px */
/* Mobile */
margin-right: 3.5rem; /* 56px */
margin-bottom: 6rem; /* 96px */
/* Mobile */
margin-bottom: 3.5rem; /* 56px */
margin-left: 6rem; /* 96px */
/* Mobile */
margin-left: 3.5rem; /* 56px */
margin: 8rem; /* 128px */
/* Mobile */
margin: 5rem; /* 80px */
margin-left: 8rem; /* 128px */
margin-right: 8rem; /* 128px */
/* Mobile */
margin-left: 5rem; /* 80px */
margin-right: 5rem; /* 80px */
margin-top: 8rem; /* 128px */
margin-bottom: 8rem; /* 128px */
/* Mobile */
margin-top: 5rem; /* 80px */
margin-bottom: 5rem; /* 80px */
margin-top: 8rem; /* 128px */
/* Mobile */
margin-top: 5rem; /* 80px */
margin-right: 8rem; /* 128px */
/* Mobile */
margin-right: 5rem; /* 80px */
margin-bottom: 8rem; /* 128px */
/* Mobile */
margin-bottom: 5rem; /* 80px */
margin-left: 8rem; /* 128px */
/* Mobile */
margin-left: 5rem; /* 80px */
margin: 10rem; /* 160px */
/* Mobile */
margin: 7rem; /* 112px */
margin-left: 10rem; /* 160px */
margin-right: 10rem; /* 160px */
/* Mobile */
margin-left: 7rem; /* 112px */
margin-right: 7rem; /* 112px */
margin-top: 10rem; /* 160px */
margin-bottom: 10rem; /* 160px */
/* Mobile */
margin-top: 7rem; /* 112px */
margin-bottom: 7rem; /* 112px */
margin-top: 10rem; /* 160px */
/* Mobile */
margin-top: 7rem; /* 112px */
margin-right: 10rem; /* 160px */
/* Mobile */
margin-right: 7rem; /* 112px */
margin-bottom: 10rem; /* 160px */
/* Mobile */
margin-bottom: 7rem; /* 112px */
margin-left: 10rem; /* 160px */
/* Mobile */
margin-left: 7rem; /* 112px */
margin-right: auto;
margin-bottom: auto;
Padding Sizes
padding-right: 0;
padding-bottom: 0;
padding-right: 0.5rem; /* 8px */
padding-bottom: 0.5rem; /* 8px */
padding-right: 0.75rem; /* 12px */
padding-bottom: 0.75rem; /* 12px */
padding-right: 1rem; /* 16px */
padding-bottom: 1rem; /* 16px */
padding: 1.5rem; /* 24px */
/* Mobile */
padding: 1.25rem; /* 20px */
padding-left: 1.5rem; /* 24px */
padding-right: 1.5rem; /* 24px */
/* Mobile */
padding-left: 1.25rem; /* 20px */
padding-right: 1.25rem; /* 20px */
padding-top: 1.5rem; /* 24px */
padding-bottom: 1.5rem; /* 24px */
/* Mobile */
padding-top: 1.25rem; /* 20px */
padding-bottom: 1.25rem; /* 20px */
padding-top: 1.5rem; /* 24px */
/* Mobile */
padding-top: 1.25rem; /* 20px */
padding-right: 1.5rem; /* 24px */
/* Mobile */
padding-right: 1.25rem; /* 20px */
padding-bottom: 1.5rem; /* 24px */
/* Mobile */
padding-bottom: 1.25rem; /* 20px */
padding-left: 1.5rem; /* 24px */
/* Mobile */
padding-left: 1.25rem; /* 20px */
padding: 2rem; /* 32px */
/* Mobile */
padding: 1.5rem; /* 24px */
padding-left: 2rem; /* 32px */
padding-right: 2rem; /* 32px */
/* Mobile */
padding-left: 1.5rem; /* 24px */
padding-right: 1.5rem; /* 24px */
padding-top: 2rem; /* 32px */
padding-bottom: 2rem; /* 32px */
/* Mobile */
padding-top: 1.5rem; /* 24px */
padding-bottom: 1.5rem; /* 24px */
padding-top: 2rem; /* 32px */
/* Mobile */
padding-top: 1.5rem; /* 24px */
padding-right: 2rem; /* 32px */
/* Mobile */
padding-right: 1.5rem; /* 24px */
padding-bottom: 2rem; /* 32px */
/* Mobile */
padding-bottom: 1.5rem; /* 24px */
padding-left: 2rem; /* 32px */
/* Mobile */
padding-left: 1.5rem; /* 24px */
padding: 3rem; /* 48px */
/* Mobile */
padding: 1.75rem; /* 28px */
padding-left: 3rem; /* 48px */
padding-right: 3rem; /* 48px */
/* Mobile */
padding-left: 1.75rem; /* 28px */
padding-right: 1.75rem; /* 28px */
padding-top: 3rem; /* 48px */
padding-bottom: 3rem; /* 48px */
/* Mobile */
padding-top: 1.75rem; /* 28px */
padding-bottom: 1.75rem; /* 28px */
padding-top: 3rem; /* 48px */
/* Mobile */
padding-top: 1.75rem; /* 28px */
padding-right: 3rem; /* 48px */
/* Mobile */
padding-right: 1.75rem; /* 28px */
padding-bottom: 3rem; /* 48px */
/* Mobile */
padding-bottom: 1.75rem; /* 28px */
padding-left: 3rem; /* 48px */
/* Mobile */
padding-left: 1.75rem; /* 28px */
padding: 4rem; /* 64px */
/* Mobile */
padding: 2.5rem; /* 40px */
padding-left: 4rem; /* 64px */
padding-right: 4rem; /* 64px */
/* Mobile */
padding-left: 2.5rem; /* 40px */
padding-right: 2.5rem; /* 40px */
padding-top: 4rem; /* 64px */
padding-bottom: 4rem; /* 64px */
/* Mobile */
padding-top: 2.5rem; /* 40px */
padding-bottom: 2.5rem; /* 40px */
padding-top: 4rem; /* 64px */
/* Mobile */
padding-top: 2.5rem; /* 40px */
padding-right: 4rem; /* 64px */
/* Mobile */
padding-right: 2.5rem; /* 40px */
padding-bottom: 4rem; /* 64px */
/* Mobile */
padding-bottom: 2.5rem; /* 40px */
padding-left: 4rem; /* 64px */
/* Mobile */
padding-left: 2.5rem; /* 40px */
padding: 6rem; /* 96px */
/* Mobile */
padding: 3.5rem; /* 56px */
padding-left: 6rem; /* 96px */
padding-right: 6rem; /* 96px */
/* Mobile */
padding-left: 3.5rem; /* 56px */
padding-right: 3.5rem; /* 56px */
padding-top: 6rem; /* 96px */
padding-bottom: 6rem; /* 96px */
/* Mobile */
padding-top: 3.5rem; /* 56px */
padding-bottom: 3.5rem; /* 56px */
padding-top: 6rem; /* 96px */
/* Mobile */
padding-top: 3.5rem; /* 56px */
padding-right: 6rem; /* 96px */
/* Mobile */
padding-right: 3.5rem; /* 56px */
padding-bottom: 6rem; /* 96px */
/* Mobile */
padding-bottom: 3.5rem; /* 56px */
padding-left: 6rem; /* 96px */
/* Mobile */
padding-left: 3.5rem; /* 56px */
padding: 8rem; /* 128px */
/* Mobile */
padding: 5rem; /* 80px */
padding-left: 8rem; /* 128px */
padding-right: 8rem; /* 128px */
/* Mobile */
padding-left: 5rem; /* 80px */
padding-right: 5rem; /* 80px */
padding-top: 8rem; /* 128px */
padding-bottom: 8rem; /* 128px */
/* Mobile */
padding-top: 5rem; /* 80px */
padding-bottom: 5rem; /* 80px */
padding-top: 8rem; /* 128px */
/* Mobile */
padding-top: 5rem; /* 80px */
padding-right: 8rem; /* 128px */
/* Mobile */
padding-right: 5rem; /* 80px */
padding-bottom: 8rem; /* 128px */
/* Mobile */
padding-bottom: 5rem; /* 80px */
padding-left: 8rem; /* 128px */
/* Mobile */
padding-left: 5rem; /* 80px */
padding: 10rem; /* 160px */
/* Mobile */
padding: 7rem; /* 112px */
padding-left: 10rem; /* 160px */
padding-right: 10rem; /* 160px */
/* Mobile */
padding-left: 7rem; /* 112px */
padding-right: 7rem; /* 112px */
padding-top: 10rem; /* 160px */
padding-bottom: 10rem; /* 160px */
/* Mobile */
padding-top: 7rem; /* 112px */
padding-bottom: 7rem; /* 112px */
padding-top: 10rem; /* 160px */
/* Mobile */
padding-top: 7rem; /* 112px */
padding-right: 10rem; /* 160px */
/* Mobile */
padding-right: 7rem; /* 112px */
padding-bottom: 10rem; /* 160px */
/* Mobile */
padding-bottom: 7rem; /* 112px */
padding-left: 10rem; /* 160px */
/* Mobile */
padding-left: 7rem; /* 112px */