简体   繁体   中英

iFrame Auto Height

Is there a way to do this with iFrame and have it working with all browsers? Or would I have to go about using Javascript. If either, can someone help me?

I need to have an auto height so it expands as needed.

Thanks!

I found solution for me some time ago. It's without JS, but you have to use the table . This is how I used it for me, maybe you will need little changes for your needs.

<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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM