Files

28 lines
727 B
Markdown
Raw Normal View History

2018-10-12 15:37:13 -04:00
---
title: Add a Negative Margin to an Element
---
# Add a Negative Margin to an Element
2018-10-12 15:37:13 -04:00
---
## Problem Explanation
2018-10-12 15:37:13 -04:00
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](https://www.tutorialspoint.com/css/css_measurement_units.htm)
For example, to adjust the margin of an element to be negative you could use:
```css
.example {
margin: -10px;
}
```
<b>To adjust the padding of an individual element</b> use:
padding: `-10`px;
[You can find out much more about negative margins here](https://www.smashingmagazine.com/2009/07/the-definitive-guide-to-using-negative-margins/)
Good luck!