gpt4 book ai didi

html - 如何使 iframe 高度适合 100%?

转载 作者:太空宇宙 更新时间:2023-11-04 14:42:49 24 4
gpt4 key购买 nike

首先,对不起我的英语我还在学习,所以我会尽量解释自己。

我的问题是,如何使 iframe 高度适合 100%?我尝试了不同的解决方案,但一切正常。这是我的代码:

HTML:

<div id="header_PA">
<div id="menu_PA">
<div id="logo_PA">
<img src="_images/1.png" title="Local PA" id="logo">
</div>
<div id="sections_PA">
...
</div>

<div id="user_box">
...
</div>
</div>

<div id="sub_menu_PA"> </div>
</div>

<iframe id="iframe_PA" src="_local_pa/dashboard.php" ></iframe>

<div class="smallFooter">
...
</div>

CSS:

#header_PA{
position: fixed;
width: 100%;
height: 70px;
z-index: 999;
}

#iframe_PA{
width: 100%;
height: 100%;
margin-top: 73px;
}

.smallFooter {
background: #121212;
}

我跳过了 HTML 和 CSS 代码中不必要的部分。

结果,您可以在这张图片中看到:

Screen Capture

显然 width 属性有效,但 height 没有。有人知道我该如何解决吗?

提前致谢!

最佳答案

试试这段代码来设置 iframe 的宽度和高度,

<iframe src="_local_pa/dashboard.php" width="100%" height="200"></iframe> 

关于html - 如何使 iframe 高度适合 100%?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18140640/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com