【问题标题】:iframe validation error with scrolling HTML滚动 HTML 的 iframe 验证错误
【发布时间】:2018-11-22 08:15:50
【问题描述】:
我的大部分程序都可以验证,但这部分:
<iframe src="link.html" width='800' height='500' scrolling="no">
</iframe>
给出此验证错误:
“错误:iframe 元素上的滚动属性已过时。请改用 CSS。”
我尝试过使用溢出:隐藏,这似乎是常见的解决方案,但用户仍然可以滚动。我希望 iframe 没有滚动条并且用户无法滚动。
感谢您的帮助。
【问题讨论】:
标签:
html
validation
iframe
【解决方案1】:
尝试使用 css:
iframe {
width:800px;
height:500px; /* you have to specify width and heigth, otherwise overflow has no meaning */
overflow-x:hidden;
overflow-y:hidden
}
/* optionally, you could add the following code, to keep scrolling (but not the scrollbar) for touchscreen devices */
iframe::-webkit-scrollbar {
display: none;
}