最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Is there a way to hide the scrollbars in IE8? - Stack Overflow

programmeradmin7浏览0评论

do you know whether there is a way to not let the scrollbars in IE8 appear? I've got a plete empty .html site and loaded it in IE8 and scrollbars are appearing.

I've been searching the net for a while, but couldn't find any hint. Is it solveable with CSS or do I need Javascript?

Every hint is much appreciated.

do you know whether there is a way to not let the scrollbars in IE8 appear? I've got a plete empty .html site and loaded it in IE8 and scrollbars are appearing.

I've been searching the net for a while, but couldn't find any hint. Is it solveable with CSS or do I need Javascript?

Every hint is much appreciated.

Share Improve this question edited Nov 5, 2010 at 9:09 BoltClock 724k165 gold badges1.4k silver badges1.4k bronze badges asked Nov 5, 2010 at 9:05 FailiFaili 1,0005 gold badges14 silver badges27 bronze badges 1
  • You didn't find this then: stackoverflow./questions/964717 – Graham Clark Commented Nov 5, 2010 at 9:15
Add a ment  | 

3 Answers 3

Reset to default 11

You can use the CSS overflow property to hide the scrollbars:

html, body {
    overflow: hidden;
}

If your blank HTML page is standards-pliant (to some degree I suppose), IE8 will not display scrollbars. You shouldn't need any CSS. Here's a sample page that won't have scrollbars:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3/1999/xhtml" xml:lang="en-US" lang="en-US">
    <head>
        <title>test</title>
    </head>
    <body>
        <p>hello</p>
    </body>
</html>

If IE8 renders the page in Quirks Mode, it will always have scroll bars. You can check exactly what rendering it's using (and test different renderings) in the Developer Tools window (press F12). The "Browser Mode" and "Document Mode" settings at the end of the menu bar will tell you.

You can try doing overflow:hidden; in your css file, in the body,html tags.

发布评论

评论列表(0)

  1. 暂无评论