gpt4 book ai didi

html - 将 IFrame 的高度设置为 100% 不会导致它扩展以填充页面吗?

转载 作者:太空宇宙 更新时间:2023-11-04 04:11:20 25 4
gpt4 key购买 nike

我正在尝试显示一个 iframe 并让它填满整个页面。为此,我使用:

<iframe src="http://cnn.com" style="margin-top: 80px;" height="100%" width="100%" ></iframe>

没有外部样式表或任何东西,它只是一个显示此 iframe 的准系统 html 页面。

然而,虽然这确实使 iframe 填充了页面的 100%(即它水平扩展到全宽),但 iframe 仍然保持大约 300-400 像素的垂直长度。显然这不足以显示整个页面,所以它有一个垂直滚动条。

如果我将高度设置为 1000 像素或 1500 像素,那么它确实有效,但我更喜欢使用百分比,所以它既不会太大也不会太小。

有什么想法吗?

最佳答案

htmlbody 标签的高度设置为 100%:

html, body {
height: 100%;
}

关于html - 将 IFrame 的高度设置为 100% 不会导致它扩展以填充页面吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20616140/

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