【发布时间】:2016-09-08 23:29:15
【问题描述】:
我遇到了一个显然只存在于 IE 11 中的问题。这是针对 Intranet 页面的。相关代码如下。
<!DOCTYPE HTML>
<html>
<head>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<meta http-equiv="X-UA-Compatible" content="IE=11" />
<title>Result</title>
</head>
<body>
<div id="chatcontent">
<iframe class="noscrolling" src="intranetsharepoint" target="_blank" scrolling="no"></iframe>
</div>
</body>
</html>
stylesheet.css
body {
background-color: #F0F8FF;
}
#chatcontent{
width:20%;
margin: auto;
}
.noscrolling{
height: 50px;
width: 120px;
overflow: hidden;
border: 0;
overflow-x: hidden;
overflow-y: hidden;
}
iframe{
overflow-x: hidden;
}
我一直在努力想弄清楚为什么在所有其他浏览器中,滚动条会自行禁用,但在 IE 11 中它们拒绝在 iFrame 元素中消失。将overflow: hidden 放入正文时效果很好,无法滚动到任何地方,只是在iFrame 中似乎不起作用。我已经尝试了overflow: hidden 的所有变体,滚动=否,通过!DOCTYPE 声明强制 html 4,与旧版本的 IE 兼容,但似乎没有任何效果。在这一点上的任何建议都是天赐之物。我看到了一段可以用 JS 生成iFrame 的代码,但是我对这种语言的理解还不够,无法将它与我已经拥有的东西放在一起。任何帮助将不胜感激。它在 Chrome 和 FF 中按预期工作。
【问题讨论】:
标签: html css internet-explorer iframe overflow