iframe 100%高度问题 [英] iframe 100% height issue
问题描述
在此问题中,我希望iframe占据整个蓝框.
In this issue here I want the iframe to occupy the whole blue box.
我给了宽度和高度100%,但是高度没有作用.可以解决吗?
I have given width and height 100% but height has no effect. Any fix?
推荐答案
将您的 display:table-row
更改为 display:block
.还要注意,填充div的高度百分比仅适用于具有固定高度的父容器(通过 px
或其他方式)或以百分比%
起作用. 此处 是正确的小提琴.
Change your display: table-row
to display: block
. Also notice that height percentage to fill a div will work only of the parent container has a fixed height, either by px
or something else, or in percentage %
. Here is the corrected fiddle.
否则,您可以尝试使用自己的布局.但是将 position:absolute; width:300px; height:250px;
添加到您的div #two
中.如果要使用百分比显示某些元素,则应定义其父容器的属性(宽度和高度),然后子元素才能拉伸.
Else you may try with your own layout. But add position: absolute;width:300px;height:250px;
to your div #two
. If you want to display some element using percentage, then it's parent container's attributes (width and height) should be defined, and only then, the child will stretch.
此处 是小提琴.
这篇关于iframe 100%高度问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!