当前位置: 动力学知识库 > 问答 > 编程问答 >

html - How to get an iframe to occupy full width (i.e. display like a div)

问题描述:

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;

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.

Working: With a DIV on the right - http://jsbin.com/onaxax/1/edit

Not Working: With an IFRAME on the right - http://jsbin.com/erapuv/1/edit

网友答案:

You have to wrap your iframe in element with overflow:hidden that would occupy the remaining space, and than set the iframe's width to 100%.

Example.

分享给朋友:
您可能感兴趣的文章:
随机阅读: