Why is there a space between the <body> and the <html> element

css, html

Solution

Because your `<p>Platform</p>` element has a margin that pokes out of its parent `<div id="airport">` element and offsets it from the `<body>`.

Problem

Why is there a space between the top of the green box and the browser window (in Chrome and Firefox)? There is an apparent space between the html and body element that I cannot seem to eliminate with the CSS below (and dozens of variations upon it.) there also seems to be some bonus padding on the overall document height, as if some aspect of padding or margin is not being reset to 0. Helpful tip: http://reference.sitepoint.com/css/collapsingmargins I solved this problem by using the following code: ``` div#aiport > *:first-child { margin-top: 0px } ``` while adding ``` overflow: hidden; ``` to the `div#airport` definition by itself solved the problem correctly. :-) ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>bug</title> <link rel="icon" type="image/png" href="bookmarkIcon.png" /> <style type="text/css"> html { height: 100%; min-height: 100%; padding: 0px; margin: 0px; } body { margin: 0px; padding: 0px; margin-top: 0px; padding-top: 0px; width: 100%; height: 100%; font-size: 16px; background: #fff; } div#airport { position: relative; z-index: 1; top: 0px; padding: 0px; padding-top: 0px; margin: 0px; margin-top: 0px; margin-left: auto; margin-right: auto; width: 900px; min-width: 900px; max-width: 900px; background-color: #0f0; } </style> </head> <body lang="en"> <div id="airport"> <p>Platform</p> </div> </body> </html> ```

Original source