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

Small margin left when div width defined to be 100%

I’m trying to make a fairly simple website and so far all I have is the top title bar. For some reason, there is a small margin on the left side. Any idea why and how to fix it?

The website on internet explorer

.headbar {
  background-color: #117FF2;
  position: fixed;
  top: 0;
  width: 100%;
  margin: 0 auto;
  padding: 0;
}
<div class='headbar'>
  <h1> Title </h1>
</div>

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

>Solution :

I think it’s probably caused by the default margin of body element.

Try this:

body {
  margin: 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