开发者

How to make an IFRAME stretch all the vertical space inside a table cell?

开发者 https://www.devze.com 2023-04-04 15:42 出处:网络
I have a table cell whose width is fixed at 180 pixels and height is variable. I want to display an IFRAME inside it.

I have a table cell whose width is fixed at 180 pixels and height is variable. I want to display an IFRAME inside it.

My code is as below:

<iframe
    src="mypage.html"
    width="180px"
    height="100%"
    frameborder="0">
</iframe>

It works in Google Chrome 13.0.782.220 without any problem.

But in Mozilla Firefox 6.0.2, the height of the I开发者_StackOverflowFRAME does not cover the entire cell. Its height is not enough to display all of its contents, so vertical scroll bar appears.

I want to make the IFRAME stretch inside the table cell in Mozilla Firefox just like it does in Google Chrome. Is there any way to do this?


That is not possible in HTML. I had this same problem once. Try changing your design.


Per spec, if the height of your table cell is auto then the height of that iframe is also auto... If Gecko supported cells being absolute containing blocks you could do this with absolute positioning and 0 offsets, but that won't work either, unfortunately.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号