<?xml version="1.0" encoding="utf-8"?>

CSS margin property

CSS margin property

Margins define the space outside of an element's border — or, rather, the space between a box and its surrounding boxes. You can set it either with the shorthand margin property or individually with:

margin-top

margin-right

margin-bottom

margin-left

In the example above, the margin is added with the following declaration: margin: 40px;.

Improve your UX & Product skills with interactive courses that actually work