The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › html element has horrible margin-top
I have recreated my problem on code pen.
I want a full height div. it is set to height: 100vh This is working for the height of the div as expected.
body and html are set to min-height: 100% and margin: 0 yet there is a margin at the top of the page.
For some reason if I give the div a border, the space at the top goes away. Not sure why this should be the case?
The defualt margin of the heading is the issue…setting a border on the div gives the heading margin to push against.
This is why we normally use a CSS reset.