Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML/CSS: scroll bar appears below HTML elements

In Chrome and Safari, the vertical scroll bar appears below HTML content on the page, like so:

scroll bar appears below header

I fiddled with ::-webkit-scrollbar, but the closest i could get was change the scroll bar width to 0px. The div of that section is:

.displayContent { min-width:620px; width:100%; height:auto; overflow:hidden; }

This occurs in Safari (but not mobile Safari on iOS) and Chrome. Firefox is fine. I also tried fiddling with overflow as well, but could not get the results i wants.

Suggestions?

like image 939
Matthew Avatar asked Aug 06 '13 18:08

Matthew


People also ask

How do I fix the scroll bar in CSS?

The easy fix is to use width: 100% instead. Percentages don't include the width of the scrollbar, so will automatically fit. If you can't do that, or you're setting the width on another element, add overflow-x: hidden or overflow: hidden to the surrounding element to prevent the scrollbar.

Why is the horizontal scroll bar appearing CSS?

Web browsers do not take into account the width of the scrollbar on the side of a page when computing width values, so since we have a page that is longer than a single viewport, part of our page is being rendered behind the vertical scroll bar, causing the browser to display a horizontal scroll bar.

Why is there a scroll bar at the bottom of my page?

For example, you may size a Web browser window so that it takes up only half of your monitor's available width. This action causes a horizontal scroll bar to appear because page content can't fit in such a narrow space.

Which scroll bar appears at the bottom of the screen?

Horizontal scroll bar appearing at the bottom of screen.


2 Answers

Had a similar Problem.

The Problem is in the html{}

If you use something like this

 html {
    height: 100%;
    width: 100%;
    overflow: hidden;
 }

Than the overlay effect on the scrollbar apears. Remove the overflow on the style for the html and put it into the body styling and it should work.

like image 175
MFGSparka Avatar answered Oct 17 '22 18:10

MFGSparka


Try this -

html, body { 
    height:100%; 
    width:100%; 
    overflow:auto;
}
like image 2
arunvishnun Avatar answered Oct 17 '22 18:10

arunvishnun