javascript - 在 javascript、jQuery 或 css 中,如何让 div 或 iframe 扩展以填充其余空间

标签 javascript jquery html css xhtml

我有三个 iframe,我将顶部 iframe 设置为 50px 高度,将底部 iframe 设置为 50px,但我希望中间 iframe 扩展以填充其余空间。有没有一种技术可以用于任何窗口屏幕尺寸? 谢谢。

例子:

<iframe style="width:100%; height:50px;" src="headerstuff.asp" %></iframe>
<iframe style="width:100%; height:100%;" src="Content.asp" %></iframe>  <!-- height needs to fill -->
<iframe style="width:100%; height:50px;" src="footerstuff.asp" %></iframe>

最佳答案

对于 div,这很简单。我不确定这是否适用于 iframe,但您的问题标题表明 div 就足够了:

<div style='background:red; position:absolute; top:0; left:0; right:0; height:50px;'></div>
<div style='background:green; position:absolute; top:50px; left:0; right:0; bottom:50px;'></div>
<div style='background:blue; position:absolute; bottom:0; left:0; right:0; height:50px;'></div>

关于javascript - 在 javascript、jQuery 或 css 中,如何让 div 或 iframe 扩展以填充其余空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7651440/

相关文章:

javascript - 未捕获错误 : process. 不支持绑定(bind)(browserify+selenium-webdriver)

javascript - Redux-form onChange 处理程序可能被覆盖

javascript - 获取图像宽度的最早事件

html - 如何设置您创建的桌面小工具的大小

javascript改变body的行高

javascript - AngularJS 指令中的元素高度

javascript - 正则表达式在JS中排除符号前的字符

javascript - jQuery 自定义滚动条插件不随 horizo​​ntalScroll 更新 : true

php - jQuery 和 php 注册脚本不起作用

php - 根据选定的单选按钮隐藏 div