<td width="120" valign="top" height="100%">
<iframe src="menu.php" width="100%" height="100%" frameborder="0">
</iframe>
</td>
此代码始终提供浏览器中iFrame的默认大小(与:
<iframe src="menu.php">
</iframe>
)
我想让IFrame得到容器单元的大小。
我知道我可以使用PHP在那里包含一个文件,但我想创建一个带有滚动条的长菜单。另一个解决方案也很好,因为就我个人而言,我不喜欢IFrames。
谢谢,
伊凡
编辑:
现在我有了这个,它没有显示div:
<html>
<head >
<title>Untitled Page</title>
<style type="text/css">
.scroller { height:100%; overflow:auto; }
</style>
</head>
<body style="background-color: #7C70DA; font-family: Fixedsys, Courier, Courier New; text-align:center; vertical-align:center;">
<center>
<div style="position:absolute; left: 40px; right:40px; top: 40px; bottom:40px; background-color: #3931A5; vertical-align:middle; color: #7C70DA ">
<table border="0">
<tr>
<td width="160" valign="top" height="100%">
<div class="scroller">
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
Lipsum <br />
</div>
</td>
<td width="100%" valign="top">
</td>
</tr>
</table>
<br />
(c) YVAN JANSSENS 2010 </div>
</center>
</body>
</html>
最佳答案
您可以将菜单内容放在div中,设置div的高度,并将overflow value设置为auto或scroll。另外,我想鼓励您放弃在HTML中使用表,而是考虑在布局中使用类似于960 Grid System的CSS框架。
.scroller { height:500px; overflow:auto; }
--
<div class="scroller">
<ul>
<li>Options</li>
<li>Options</li>
<li>Options</li>
<li>Options</li>
<li>Options</li>
<li>Options</li>
</ul>
</div>
关于html - 如何使IFRAME的大小成为容器的大小?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/2140659/