user2713996
user2713996

Reputation: 147

Scrollbars is added, but elements does not fill the page

I am working on a website, at the moment on a sign-up page. Its all perfect, right until i realize some very annoying. I have kinda 2 elements on this page. A sign up div, and an img, for the logo in the top. And it is not even close to fill the whole html page. But it still adds the SCROLL BARS, and i can scroll like 20 px up and down, and from side to side. Very annoying plz help

Upvotes: 0

Views: 133

Answers (2)

heretolearn
heretolearn

Reputation: 6555

This can be fixed in two ways

Either change the width and height of the body to auto as:

html, body {   
 width: auto;   
height: auto;    

background: #11BD83;
}

JsFiddle

Or as suggested by @Per Salbark add margin : 0 to the body

html, body {   
 width: 100%;   
height: 100%;    
margin : 0;
background: #11BD83;
}

JsFiddle

Upvotes: 0

Per Salbark
Per Salbark

Reputation: 3645

You want to add margin: 0; to your body.

It's already 100% wide, and the margin pushes the width beyond the space available on screen. This causes a vertical scrollbar, and that, in turn, causes a horizontal scrollbar.

Upvotes: 1

Related Questions