Html 如何让 iframe 占据全宽(即像 div 一样显示)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13158883/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to get an iframe to occupy full width (i.e. display like a div)
提问by techfoobar
I'm trying to get an iframe
to behave like a normal non-floating DIV
does. i.e. occupy full width of parent. Is this possible? Looking for something equivalent to saying display: div;
我试图让一个iframe
行为像一个正常的非浮动DIV
。即占据父级的全宽。这可能吗?寻找相当于说的话display: div;
Edit: I'm not looking for width: 100%
since i have another floating element to the left. A non-floating DIV would take the rest of the space on the right. This is the behavior i'm looking to achieve.
编辑:我不是在寻找,width: 100%
因为我左边有另一个浮动元素。非浮动 DIV 将占据右侧的其余空间。这是我希望实现的行为。
Working: With a DIV
on the right - http://jsbin.com/onaxax/1/edit
工作:DIV
在右边 - http://jsbin.com/onaxax/1/edit
Not Working: With an IFRAME
on the right - http://jsbin.com/erapuv/1/edit
不工作:IFRAME
在右边 - http://jsbin.com/erapuv/1/edit