2

I'm working on a website and I just noticed there there is this unexplained white space at the top and bottom of my page. I search through some post and they told me to make sure I used UTF-8 encoding without BOM and I tried that and it made no difference. If anyone would be willing to look at it the url is url

Pavel S.
  • 11,892
  • 18
  • 75
  • 113
Absolutezero
  • 31
  • 1
  • 1
  • 4

6 Answers6

12

The default spacing (margin) on the <h1> element is causing the top spacing. Add this in your css.

h1 { margin-top: 0; }
Mike Vranckx
  • 5,557
  • 3
  • 25
  • 28
1

It's not a space.. There is a button on the top right corner.

Remove this source from your HTML code

    <div id="escapeButton">
        <button> <a href="http://google.com" title="escape">Escape</a> </button>
    </div>
Shankar Narayana Damodaran
  • 68,075
  • 43
  • 96
  • 126
1

add this on first line of css

* {
margin: 0px;
padding: 0px;
}
vincent kleine
  • 724
  • 1
  • 6
  • 22
1

I have also had this problem and used this in the first line of my CSS file:

body {
padding: 0;
margin: 0;
}

You can also add margin-top: -10px; if there are still problems.

daneasaur
  • 21
  • 1
  • 4
0

If setting h1 { margin-top: 0px } works, maybe you encounter the collapsing margins problem.

You can know more in margin-top in a nested div

Community
  • 1
  • 1
0

in my case, a div with style like this

    margin: 0 auto 80px;

make an extra white space on top

Anh Lam
  • 122
  • 1
  • 1
  • 7