margin-right

Sets the amount of empty space on the right side of an element. This creates a gap between the element and whatever is to its right.

It is documented as part of the CSS Anchor Positioning, CSS Box Model specification.

/* Usage Example */
.icon-with-margin {
  /* Adds space to the right of the icon */
  margin-right: 8px;
}

/* Syntax */
margin-right: auto;
margin-right: anchor-size;

/* Global values */
margin-right: inherit;
margin-right: initial;
margin-right: revert;
margin-right: revert-layer;
margin-right: unset;
Widely available Since 2015 96% global usage

This feature is well established and works across many devices and browser versions. It has been available across browsers since 2015.

1+
1+
1+
12+
Kinsta

Your first month is free

Managed WordPress hosting for faster sites.

Learn more

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC