【问题标题】:iFrame Auto HeightiFrame 自动高度
【发布时间】:2012-12-09 09:29:04
【问题描述】:

有没有办法用 iFrame 做到这一点,并让它在所有浏览器上都可以使用?或者我是否必须使用 Javascript。如果有的话,有人可以帮助我吗?

我需要有一个自动高度,以便它根据需要扩展。

谢谢!

【问题讨论】:

标签: javascript iframe


【解决方案1】:

我前段时间为我找到了解决方案。它没有JS,但你必须使用table。这就是我为我使用它的方式,也许你需要做一些小的改动来满足你的需要。

<head>
<style>
*{margin:0;padding:0}
html, body {height:100%;width:100%;overflow:hidden}
table {height:100%;width:100%;table-layout:static;border-collapse:collapse}
iframe {height:100%;width:100%}

.header {border-bottom:1px solid #000}
.content {height:100%}
</style>
</head>

<table>
  <td class="header"></td>
  <td class="content" width="80%" valign="top"><iframe id="reportframe" src="src.html" frameborder="0"></td>
</table>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-08-01
    • 1970-01-01
    • 2013-02-21
    • 2011-08-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多