删除IE8中的页滚动条(overflow:hidden不工作) [英] removing page scrollbars in IE8 (overflow:hidden not working)

查看:115
本文介绍了删除IE8中的页滚动条(overflow:hidden不工作)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应用此

overflow:hidden;

到我的文档的正文在IE8没有效果。任何想法为什么?

to the body of my document has no effect in IE8. Any ideas why?

推荐答案

这取决于IE8是以标准或怪异模式呈现页面。例如,下面的HTML将不显示滚动条:

It depends on whether IE8 is rendering the page in Standards or Quirks mode. For example, the following HTML will be displayed without a scrollbar:

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

但是如果你删除了doctype声明,IE8会以Quirks模式渲染页面:

But if you remove the doctype declaration, IE8 renders the page in Quirks mode:

<html>
    <head>
        <title>test</title>
    </head>
    <body>
        <p>hello</p>
    </body>
</html>

您也可以通过强制使用开发工具的渲染模式来检查。在页面上按F12,在菜单栏的结尾(由于某种原因...)有一个文档模式设置。在标准和Quirks之间切换也应该切换滚动条。

You can also check this by forcing the rendering mode with the Developer Tools. Press F12 on a page, and at the end of the menu bar (for some reason...) there's a "Document Mode" setting. Toggling between Standards and Quirks here should also toggle the scrollbar.

所以...你需要让你的页面遵循HTML标准!它不一定是XHTML严格的,它可以是HTML 4,或者甚至XHTML Transitional如果你真的必须。

So... you need to make your page adhere to an HTML standard! It need not be XHTML Strict, it could be HTML 4, or even XHTML Transitional if you really must.

W3C Validator 可以帮助您解决任何验证错误。

The W3C Validator can help you with any validation errors.

这篇关于删除IE8中的页滚动条(overflow:hidden不工作)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆