Why are using offset instead of margin?

Tell us what’s happening:

Your code so far


<head>
<style>
h2 {
  position: relative;


}
</style>
</head>
<body>
<h1>On Being Well-Positioned</h1>
<h2>Move me!</h2>
<p>I still think the h2 is where it normally sits.</p>
</body>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36.

Challenge: Move a Relatively Positioned Element with CSS Offsets

Link to the challenge:
https://www.freecodecamp.org/learn/responsive-web-design/applied-visual-design/move-a-relatively-positioned-element-with-css-offsets

Welcome, Adjile.

In general, you would use offset instead of margin, because margin spaces an element around adjacent elements, thereby directly affecting adjacent elements. offset is more of a positioning tool just like saying top: 10px;, but offset is relative to the flow of the page, whilst top is relative to the top of the page.

I hope that helps.