Margins

Learn how margins work in CSS.

Box model properties

The values held by the margin, padding, and border properties directly affect the size of an element’s box. We’ll see how these properties relate to the box model, beginning with the margin property.

The margin property

The margin property defines the outer portion of the box model. It creates space around an element outside ofany borders. In other words, it’s an invisible space around the box that pushes other elements away from it.

Get hands-on with 1400+ tech skills courses.