SCROLLING =没有!不会隐藏滚动

时间:2011-04-21 21:44:46

标签: html css

根据“验证器w3c”,iframe元素上的滚动属性已过时。这意味着对于iFrame,有一个Scrolling =“no”CSS等价物。

我试过了: Overflow: hidden;但没有成功。

这里有一个例子:

1)Scrolling="no" (it works fine)

但w3c确实抱怨

2)Scrolling="no" CSS equivalent, (it doesn't work because it shows the scroll)

2 个答案:

答案 0 :(得分:4)

scroll: 'no'

不是有效的CSS属性。

IE已知iFrames和CSS溢出属性存在问题。

真的,这里最好的解决方案是在您的iFrame标记内使用scrolling="no"。确实,它不符合W3标准 - 但没有客户会因为有W3标准问题而逃离您的网站。一般人不知道Web标准是什么,更不用说W3了。

答案 1 :(得分:1)

以下javascript在FF,Chrome和IE中为我工作

var el = document.getElementById("iframeid")
el.scrolling = "no"; //FF & Chrome
el.contentWindow.document.documentElement.style.overflow="hidden"; //IE