gpt4 book ai didi

html - 如何仅使用 html 内联样式使 iframe 高度在 div 内达到 100%

转载 作者:行者123 更新时间:2023-11-27 23:21:00 25 4
gpt4 key购买 nike

使用下面的当前代码,它为我提供了一个滚动条,但我希望显示整个网页。如果我将高度从 100% 更改为 1150px,它似乎可以工作,但我希望它是动态的,因此,想让它成为 100%。宽度似乎在 100% 时工作正常,只是高度不行。

<div style="overflow:auto;-webkit-overflow-scrolling:touch; border:1px solid black">
<iframe src="http://help.websiteos.com/websiteos/example_of_a_simple_html_page.htm"
style="width:100%;height:100%"></iframe>
</div>

最佳答案

使用内联样式是一种不好的做法,我建议使用 css 类来应用这些样式

.iframeStyle{
width:100%;
height:100%;
border: 0;
}

.divIFrame{
overflow:auto;
-webkit-overflow-scrolling:touch;
border:1px solid black;
}
<div class="divIFrame">
<iframe src="http://help.websiteos.com/websiteos/example_of_a_simple_html_page.htm" class="iframeStyle"></iframe>
</div>

关于html - 如何仅使用 html 内联样式使 iframe 高度在 div 内达到 100%,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57999009/

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