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

My sticky header does not cover the viewport width

Please I have created a sticky header and every thing goes well except that this header does not cover all the viewport width and skips a little space at the top of the page.
I used "margin: 0" but in vain.
Thanks!!

<body>
<header> /*nav bar*/
</header>
<div>
/*Some content*/
</div>
<footer>
</footer>
</body>
body{
display: flex;
flex-diection: column;
}

header{
position: sticky;
top: 0;
width: 100%;
margin: 0;
}    

>Solution :

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

the body element by default has a margin of 8px. You need to add body{margin:0} to your css

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