freeCodeCamp/guide/english/certifications/responsive-web-design/basic-css/add-a-negative-margin-to-an.../index.md

701 B

title
Add a Negative Margin to an Element

Add a Negative Margin to an Element

Margin is the spacing between the border of an element and other elements on the page.

•There is spacing from the top, right, bottom, and left.

•The number is in css units

For example, to adjust the margin of an element to be negative you could use:

.example {
margin: -10px;
}

To adjust the padding of an individual element use: padding: -10px;

You can find out much more about negative margins here

Good luck!