Munch
Munch

Reputation: 779

Making a div 100% browser height

I know this has been asked many times and I've tried the fixes provided.

I saw this post: Make div 100% height of browser window

and I followed what it said, make the div instead

height: 100%; /* Make it */
height: 100vh;

however my div still has a gap between the top of it and the browser window.

https://jsfiddle.net/hgs3d1n6/

What am I missing or not doing which is causing this problem? I've tried other suggestions to like making the html, body 100%.

Thanks.

Upvotes: 0

Views: 74

Answers (1)

j08691
j08691

Reputation: 207861

Both the body and paragraph elements have a default margin. The easiest way to clear that cross browser is with:

body,p {
    margin:0;
}

jsFiddle example

Upvotes: 2

Related Questions