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
Asked
Active
Viewed 1.4k times
6 Answers
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
-
It is not the button which is causing the space. Check the CSS, it has a `fixed` positioning ... – Mike Vranckx Nov 16 '13 at 18:06
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

David Zhang
- 1
- 2
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