iframe没有在html中显示内容

时间:2016-02-25 20:18:59

标签: php html iframe

toonzaal.php (html页面,但包含php代码 - >这就是为什么.php)

<iframe data-src="toonzaal.html" scrolling="no" frameborder="0" style="height:600px"></iframe>  

enter image description here

我猜的空格是iframe,但不知道为什么还有更多的东西出现。

toonzaal.html

这是我希望在toonzaal.php页面中显示较小的滑块(图片)

enter image description here

enter image description here

文件夹结构

enter image description here

1 个答案:

答案 0 :(得分:2)

根据w3 html5 reference on embedded contentdata-src元素没有iframe这样的属性。

您应该使用src代替。

<iframe src="toonzaal.html" scrolling="no" frameborder="0" style="height:600px"></iframe>

应该工作。

<强>另外

Frameborder属性在HTML5中已过时。您可以使用CSS。在您的情况下,它将是border: none;

虽然HTML5中的scrolling也已过时,但大多数浏览器仍然支持它,并且它们与overflow: hidden;元素的iframe css属性不兼容。这就是为什么你的iframe应该是这样的:

<iframe src="toonzaal.html" scrolling="no" style="height:600px; border: none;"></iframe>
相关问题