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

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #241119

    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.
    Please help!


    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?


    Collapsing margins.

    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.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.