Search code examples
htmlcssscrollbarinternet-explorer-11internet-explorer-10

How can I prevent the scrollbar overlaying content in IE10?


In IE10, the scrollbar is not always there... and when it appears it comes on as an overlay... It's a cool feature but I would like to turn it off for my specific website as it is a full screen application and my logos and menus are lost behind it.

IE10:

enter image description here

CHROME:

enter image description here

Anyone know a way of always having the scrollbar fixed in position on IE10?

overflow-y:scroll doesn't seem to work! it just puts it permanently over my website.

It may be bootstrap causing the issue but which part I have no idea! see example here: http://twitter.github.io/bootstrap/


Solution

  • After googling a bit I stumbled across a discussion where a comment left by "Blue Ink" states:

    Inspecting the pages, I managed to reproduce it by using:

    @-ms-viewport { width: device-width; }

    which causes the scrollbars to become transparent. Makes sense, since the content now takes up the whole screen.

    In this scenario, adding:

    overflow-y: auto;

    makes the scrollbars auto-hide

    And in bootstraps responsive-utilities.less file, line 21 you can find the following CSS code

    // IE10 in Windows (Phone) 8
    //
    // Support for responsive views via media queries is kind of borked in IE10, for
    // Surface/desktop in split view and for Windows Phone 8. This particular fix
    // must be accompanied by a snippet of JavaScript to sniff the user agent and
    // apply some conditional CSS to *only* the Surface/desktop Windows 8. Look at
    // our Getting Started page for more information on this bug.
    //
    // For more information, see the following:
    //
    // Issue: https://github.com/twbs/bootstrap/issues/10497
    // Docs: http://getbootstrap.com/getting-started/#support-ie10-width
    // Source: http://timkadlec.com/2013/01/windows-phone-8-and-device-width/
    // Source: http://timkadlec.com/2012/10/ie10-snap-mode-and-responsive-design/
    
    @-ms-viewport {
      width: device-width;
    }
    

    This snippet is what's causing the behavior. I recommend reading the links listed in the commented code above. (They were added after I initially posted this answer.)