IE8,iframe和不必要的滚动条

0 iframe scrollbars internet-explorer-8

对于我正在进行的一项开发,我需要动态创建一个包含一些动态内容的Iframe(通常是图像 - 图像源是动态的,但尺寸是固定的).我不需要在iframe上显示任何滚动条,这就是我所做的

<iframe id="xxxx" width="70px" height="70px" style=" scrolling: no" src="content.html">
</iframe>

//content.html
<body>
    <div style="height: 100%; width: 100%; overflow: hidden">
        <img id="imgDiv" src="" style="height: 100%; width: 100%; ">
    </div>
</body>
Run Code Online (Sandbox Code Playgroud)

我也在iframe上尝试过"overflow:hidden",但观察到了类似的行为.

这在FF/Chrome/Safari中可以正常工作,但在IE8中却没有!

显然,即使指定不需要滚动条,IE也会为滚动条保留一些空间?在右侧渲染一个空白区域,使其看起来像图像不是居中对齐的.在iframe中看起来真的很难看,就像我在这里需要的那样小..

这种行为有什么办法吗?

小智 5

在iframe的声明中,为scrollling ="no"更改样式属性style ="scrolling:no"

结果: <iframe id ="xxxx"width ="70px"height ="70px" scrolling ="no" src ="content.html">