# Spacing Bootstrap includes a wide range of shorthand responsive margin and padding utility classes to modify an element’s appearance.

How it works

Assign responsive-friendly `margin` or `padding` values to an element or a subset of its sides with shorthand classes. Includes support for individual properties, all properties, and vertical and horizontal properties. Classes are built from a default Sass map ranging from `.25rem` to `3rem`.

We have further added quick margin and padding options for by using gutter space variable `.m-g`, margin bottom gutter `.mb-g`. Padding gutter can be adding by using `.p-g` modifier. The `*-g` will change based on the gutter variable.

Learn more about this component on bootstrap's official documentation also on this codepen example

## Default Panel

Spacing utilities that apply to all breakpoints, from `xs` to `xl`, have no breakpoint abbreviation in them. This is because those classes are applied from `min-width: 0` and up, and thus are not bound by a media query. The remaining breakpoints, however, do include a breakpoint abbreviation.

The classes are named using the format `{property}{sides}-{size}` for `xs` and `{property}{sides}-{breakpoint}-{size}` for `sm`, `md`, `lg`, and `xl`.

Where property is one of:

- `t` - for classes that set `margin-top` or `padding-top`
- `b` - for classes that set `margin-bottom` or `padding-bottom`
- `l` - for classes that set `margin-left` or `padding-left`
- `r` - for classes that set `margin-right` or `padding-right`
- `x` - for classes that set both `*-left` and `*-right`
- `y` - for classes that set both `*-top` and `*-bottom`
- blank - for classes that set a `margin` or `padding` on all 4 sides of the element

Where size is one of:

- `0` - for classes that eliminate the `margin` or `padding` by setting it to `0`
- `1` - (by default) for classes that set the `margin` or `padding` to `$spacer * .25`
- `2` - (by default) for classes that set the `margin` or `padding` to `$spacer * .5`
- `3` - (by default) for classes that set the `margin` or `padding` to `$spacer`
- `4` - (by default) for classes that set the `margin` or `padding` to `$spacer * 1.5`
- `5` - (by default) for classes that set the `margin` or `padding` to `$spacer * 2`
- `6` - (by default) for classes that set the `margin` or `padding` to `$spacer * 2.5`
- `auto` - for classes that set the `margin` to auto

Example padding:

.p-2 .p-sm-3 .p-md-4 .p-lg-5 .p-xl-6
.p-1 .p-sm-2 .p-md-3 .p-lg-4 .p-xl-5
.p-0 .p-sm-1 .p-md-2 .p-lg-3 .p-xl-4
.p-1 .p-sm-0 .p-md-1 .p-lg-2 .p-xl-3
.p-4 .p-sm-4 .p-md-0 .p-lg-1 .p-xl-2
.p-5 .p-sm-6 .p-md-3 .p-lg-0 .p-xl-1
.p-6 .p-sm-5 .p-md-5 .p-lg-6 .p-xl-0

## Horizontal centering

Additionally, Bootstrap also includes an `.mx-auto` class for horizontally centering fixed-width block level content—that is, content that has `display: block` and a `width` set—by setting the horizontal margins to `auto`.

Centered element

## Negative margin

The syntax is nearly the same as the default, positive margin utilities, but with the addition of `n` before the requested size.

Here’s an example of customizing the Bootstrap grid at the medium (`md`) breakpoint and above. We’ve increased the `.col` padding with `.px-md-5` and then counteracted that with `.mx-md-n5` on the parent `.row`.

Custom column padding
Custom column padding

## Margin examples

Margin specific viewports example
*-xs-* <576px
*-sm-* ≥576px
*-md-* ≥768px
*-lg-* ≥992px
*-xl-* ≥1200px
.ml-1 .ml-sm-2 .ml-md-3 .ml-lg-4 .ml-xl-5
.mx-1 .mx-sm-2 .mx-md-3 .mx-lg-4 .mx-xl-5
.my-1 .my-sm-2 .my-md-3 .my-lg-4 .my-xl-5
.m-1 .m-sm-2 .m-md-3 .m-lg-4 .m-xl-5

- Home
- Inbox
- Add More

Tracey Chang
IT Director

- Tracey Chang Online
- Oliver Kopyuv Online
- Dr. John Cook PhD Away
- Ali Amdaney Online
- Sarah McBrook Online
- oliver.kopyuv@gotbootstrap.com Offline
- oliver.kopyuv@gotbootstrap.com Busy
- oliver.kopyuv@gotbootstrap.com Offline
- +714651347790 Missed Call

Jun 19

Hey Tracey, did you get my files?

3:00 pm

Hi

Sorry going through a busy time in office. Yes I analyzed the solution.

It will require some resource, which I could not manage.

3:24 pm

Okay

Sending you some dough today, you can allocate the resources to this project.

3:26 pm

Perfect. Thanks a lot!

I will have them ready by tonight.

Cheers

Jun 20
Send

#### Layout Settings User Interface Settings

##### App Layout

Fixed Header header is in a fixed at all times
Fixed Navigation left panel is fixed
Minify Navigation Skew nav to maximize space
Hide Navigation roll mouse on edge to reveal
Top Navigation Relocate left pane to top
Fixed Footer page footer is fixed
Boxed Layout Encapsulates to a container

Fixed Background

##### Mobile Menu

Push Content Content pushed on menu reveal
No Overlay Removes mesh on menu reveal
Off-Canvas (beta) Content overlaps menu

##### Accessibility

Bigger Content Font content fonts are bigger for readability
High Contrast Text (WCAG 2 AA) 4.5:1 text contrast ratio
Daltonism (beta) color vision deficiency
Preloader Inside preloader will be inside content
SmartPanel Icons (not Panels) smartpanel buttons will appear as icons

##### Global Modifications

Clean Page Background adds more whitespace
Hide Navigation Icons invisible navigation icons
Disable CSS Animation Disables CSS based animations
Hide Info Card Hides info card from left panel
Lean Subheader distinguished page header
Hierarchical Navigation Clear breakdown of nav links
Dark Navigation Navigation background is darkend

##### Global Font Size

SM MD LG XL
Change root font size to effect rem values (resets on page refresh)

##### Theme colors more info

##### Theme Modes (beta) why beta?

###### Internet Explorer Issue

This particular component may not work as expected in Internet Explorer. Please use with caution.
Default
Light
Dark

Reset Settings
Factory Reset