Browser Scrollbar shift

后端 未结 6 1878
南方客
南方客 2021-01-05 01:59

When you go to page on my website where there is extra content, the scrollbar appears on the right, but it has a notiable shift to the left for my content. You notice this b

相关标签:
6条回答
  • 2021-01-05 02:25
    body {
       overflow: scroll;
    }
    

    I had the same problem with even the newest Firefox (3.5). The overflow function saved my life!

    0 讨论(0)
  • 2021-01-05 02:35

    I've tested this on IE6, IE7, IE8, Firefox 3, and Chrome, and the simple way to have a vertical scroll bar always visible is simply:

    html { overflow-y: scroll; } 
    
    0 讨论(0)
  • 2021-01-05 02:35

    Give this a try... I know its ugly but it may be the only way.

    #force_scroll { 
        width: 1em; 
        position: absolute; 
        top: 0; 
        bottom: -0.1px; 
        z-index: -1; 
    }
    

    And then in your HTML somewhere (preferably right before your </body>):

    <div id="force_scroll"></div>
    
    0 讨论(0)
  • 2021-01-05 02:36

    Make your body 101% tall... this will force the scrollbar to always show up.

    body {height:101%}
    
    0 讨论(0)
  • 2021-01-05 02:38

    This seems to work great for me...

    html {
        overflow-y: scroll;
    }
    
    0 讨论(0)
  • 2021-01-05 02:45

    Well, it depends on the browser.

    body {
    
    overflow-y: scroll;
    overflow-x: scroll;
    overflow: -moz-scrollbars-vertical;
    
    }
    

    Should force the horizontal (overflow-x) and vertical scrollbars (overflow-y) to be displayed. Though I recall that Opera sometimes fails to respect the declaration, unless it's on an element within the <body> (divs and the like).


    Edited with regard to @wsanville's, and @BHare's, comment.

    0 讨论(0)
提交回复
热议问题