Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrollbar appears for no reason [closed]

Alright so what my problem is is that on my website, there is a scrollbar appearing to let the user scroll like 1cm to the right.

I want to completely remote it and have the chatbox and logo actually centered in the page.

The same happens on mobile devices, the whole thing is SLIGHTLY scrollable which makes it really annoying.

Is there any way I can fix it?

Thanks a lot! Alex

like image 314
AlexGv Avatar asked Feb 07 '14 00:02

AlexGv


2 Answers

From the looks of the Chrome inspector, you have added padding to the body which will push over any content. Because your width of the body is already 100%, adding 15px of margin on either side will create 30 extra pixels of width on top of your already 100% width, creating that horizontal scrollbar.

Take a look at this JSfiddle: http://jsfiddle.net/piedoom/T52MM/1/ I've simulated padding with a large border value. This is what your extra padding is doing to the body, it is pushing it over to the right and adding unneeded space, creating the horizontal scroll bar.

However, once you remove that padding, it will work correctly. http://jsfiddle.net/piedoom/T52MM/2/

You can remove just the side padding in css by typing body{padding-left: 0; padding-right: 0;} (It'll behave like this http://jsfiddle.net/piedoom/T52MM/3/ )

like image 120
Alexander Lozada Avatar answered Oct 19 '22 04:10

Alexander Lozada


It is because you have in body CSS a width of 100%.

I disabled it in chrome and the horizontal scroll bar was gone.

width: 100%;

Try removing that and see how it goes.

like image 38
user2456783 Avatar answered Oct 19 '22 03:10

user2456783