Php 如何使此iframe使用所有高度?
我想知道如何使“this”iframe/div(用红色边框标记)使用所有可用的高度。iframe从顶部开始为160px,我希望它位于底部。当我将高度设置为100%时,它将填充所有内容,但当我降低网页高度时,它将很晚显示滚动条。这是因为他是160像素从顶部。。。有人知道怎么解决这个问题吗 php: 屏幕:Php 如何使此iframe使用所有高度?,php,css,iframe,height,max,Php,Css,Iframe,Height,Max,我想知道如何使“this”iframe/div(用红色边框标记)使用所有可用的高度。iframe从顶部开始为160px,我希望它位于底部。当我将高度设置为100%时,它将填充所有内容,但当我降低网页高度时,它将很晚显示滚动条。这是因为他是160像素从顶部。。。有人知道怎么解决这个问题吗 php: 屏幕: (在url due 10 rep…)您已将iframe的高度设置为300px: #数据{宽度:310px;高度:300px 如果要填充所有帧,应将其设置为100% <script
(在url due 10 rep…)您已将iframe的高度设置为300px: #数据{宽度:310px;高度:300px 如果要填充所有帧,应将其设置为100%
<script language="JavaScript">
<!--
function calcularAltura()
{
//Calcular a altura da página actual.
var the_height=
document.getElementById('the_iframe').contentWindow.
document.body.scrollHeight;
//Alterar a altura do iframe
document.getElementById('the_iframe').height=
the_height;
}
//-->
</script>
<iframe width="700" id="the_iframe"
onLoad="calcularAltura();"
src="/test/coredata/sidebar/theme_data.php"
scrolling="NO"
frameborder="0"
height="1">
</iframe>
它应该可以工作;)首先看起来不应该在iframe中的东西那么你会怎么做呢?当你拉更多数据时,它需要滚动。你可以滚动一个div,只需设置OverflowOpe抱歉,正如我所说;当我将高度设置为100%时,它将填充所有内容,但当我降低网页高度时,它将显示滚动条很晚了。这是因为他是从上到下的160px…有一个解决方案,css3使用flex box,但它只在IE10上工作,所以我不建议使用它。IE10,什么是ie,只是开玩笑。它需要在Chrome和Firefox上工作,ie…好吧,如果它在ie上工作,那很好,但它不是我的主要目标。
#sidebar{
width: 315px; height: 100%;
position: fixed; right: 0px;
top: 0px; background: #004d5f;
}
#data{width:310px; height:300px; position:absolute; top: 160px; left: 0px; border:3px solid #FF0000;}
<script language="JavaScript">
<!--
function calcularAltura()
{
//Calcular a altura da página actual.
var the_height=
document.getElementById('the_iframe').contentWindow.
document.body.scrollHeight;
//Alterar a altura do iframe
document.getElementById('the_iframe').height=
the_height;
}
//-->
</script>
<iframe width="700" id="the_iframe"
onLoad="calcularAltura();"
src="/test/coredata/sidebar/theme_data.php"
scrolling="NO"
frameborder="0"
height="1">
</iframe>