Skip to Main Content

Elements 2025: Spacing

Intro

Choose values for all display sizes (e.g., .me-3 for margin-right: 1rem), or pick responsive variants to target specific size (e.g., .me-md-3 for margin-right: 1rem  starting at the md breakpoint).

The classes are named using the format {property}{sides}-{size} for xs and {property}{sides}-{breakpoint}-{size} for smmdlgxl, and xxl.

Property:

  • m - for classes that set margin
  • p - for classes that set padding

Side: 

  • t - top
  • b - bottom
  • s - (start) left 
  • e - (end) right 
  • x - for both left and right  
  • y - for both top and bottom 
  • blank - all sides 

How Much:

  • 0 - eliminates margin or padding 
  • 1 - sets to 1rem 
  • 2 - sets to 2rem
  • 3 - sets to 3rem 

 

Box Model

box model. content surrounded by padding then border then margin

Example

Top Bottom