iframe 元素上的滚动属性已过时。改用 CSS
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5048793/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The scrolling attribute on the iframe element is obsolete. Use CSS instead
提问by J82
I've embedded a Google map onto my website in an iframe:
我已在 iframe 中将 Google 地图嵌入到我的网站上:
<iframe src="http://www.map-generator.net/extmap.php?name=Spot&address=los%20angeles%2C%20ca&width=614&height=244&maptype=map&zoom=14&hl=en&t=1298011905" width="614" height="244" scrolling="no"></iframe>
This is invalid, and I need to somehow pull off the scrolling aspect in CSS. How would I do this?
这是无效的,我需要以某种方式取消 CSS 中的滚动方面。我该怎么做?
回答by jmort253
<iframe style="overflow:hidden;"></iframe>
回答by user3152357
I have found another solution which worked.
我找到了另一个有效的解决方案。
<iframe src="...." class="frame-abc" scrolling='no' ></iframe>
.frame-abc {
border:none;
overflow:hidden;
margin:0;
height:230px;
width:570px;
}
回答by fat_mike
Late response
迟到的回应
The only solution I found so far is setting overflow to hidden and set width, height to a parent div.
到目前为止,我发现的唯一解决方案是将溢出设置为隐藏,并将宽度、高度设置为父 div。
In your case:
在你的情况下:
<div style="width:614px; height:244px;">
<iframe src="http://www.map-generator.net/extmap.php?name=Spot&address=los%20angeles%2C%20ca&width=614&height=244&maptype=map&zoom=14&hl=en&t=1298011905"width="614" height="244" style="overflow:hidden; width:614px; height:244px;"></iframe>
</div>