Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Margin at top of body

I have this code only (no CSS or more HTML).

When I load the html file in my browser there seems to me a 21px margin at the top (see the image link if you don’t understand what I mean).

I know that the body element normally has an 8px margin by default, so I removed the margin by adding this code through the developer tools. margin: 0px;

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Even after adding that code, I still get the 21px margin at the top of the page.

I don’t know what to do, so if you can please help me, that would me great.

body {
  margin: 0px;
}
<body>
  <div id="unit-type">
    <h1>Converter</h1>
  </div>
</body>

>Solution :

this should remove all default padding and margin

* {
margin: 0;
padding: 0;
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading