【发布时间】:2018-01-18 01:27:50
【问题描述】:
假设我在www.my-iframe.com 上托管了一个 iframe。假设我的 iframe 嵌入到不同域上的页面中,使用:
<iframe src="http://www.my-iframe.com" scrolling="no" height="500" width="100%"></iframe>
请注意,iframe 标记具有scrolling="no" 属性。
我只能编辑 iframe 代码,而不是嵌入我的 iframe 的页面。这使得我无法更改 iframe html 标记的 scrolling 属性或 iframe 的 overflow: hidden; css 样式。
有没有一种方法可以在必要时从 iframe 代码中强制显示滚动条?
感谢任何帮助/建议!
【问题讨论】:
-
你不能在顶级元素上使用
overflow: scroll(或自动)吗? -
@BenKolyaMansley 似乎不起作用。我为我的 iframe 添加了
body { overflow: scroll !important; }到我的 css 中,但它在嵌入页面时仍然不起作用。不确定这是否是因为 html 标记中的scrolling="no"覆盖了它。但这似乎不起作用:(
标签: javascript html iframe