gpt4 book ai didi

html - 固定 div 和 iframe 元素内部

转载 作者:行者123 更新时间:2023-11-28 19:10:04 27 4
gpt4 key购买 nike

我对 html 代码有疑问。我尝试了很多解决方案,但我还没有解决我的问题。我的问题是;如果我在 html 页面中使用了两个 div,并且两个 div 都必须包含 iframe 元素,我从未在浏览器中看到正确的 html 页面。

注意:每个 div 必须有 position:fixed css 属性。

示例代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title></title>
<style>
body{margin:0px;}

.modalWrapper
{
position:fixed;
display:block;
width:500px;
height:300px;
background-color:#000;
color:#fff;
margin:0px;
top:50px;
left:500px;
z-index:100;
}

.modalHeader{ width:100%; height:80px; }
.modalNavigator { background-color:#ccc; height:220px; }

.bottomWrapper
{
position:fixed;
display:block;
width:100%;
height:300px;
background-color:#000;
color:#fff;
margin:0px;
bottom:0px;
z-index:99;
}

.bottomHeader{ width:100%; height:80px; }
.bottomNavigator{ background-color:#ccc; height:220px; }

</style>

</head>
<body>


<div>
<div class="modalWrapper">
<div class="modalHeader">
Modal
</div>
<div class="modalNavigator">

<iframe frameborder="0" src="http://www.yahoo.com" id="Iframe1"
style="height: 220px; width: 100%;" scrolling="no"/>
</div>
</div>

<div class="bottomWrapper">
<div class="bottomHeader">
Bottom
</div>
<div class="bottomNavigator">
<iframe frameborder="0" src="http://www.google.com.tr" id="Iframe2"
style="height: 220px; width: 100%;" scrolling="no"/>
</div>
</div>
</div>
</body>
</html>

最佳答案

代替:

<iframe [...]/>

尝试:

<iframe [...]></iframe>

我会检查这个问题以获取更多信息,了解为什么这有帮助:Why don't self-closing script tags work?

关于html - 固定 div 和 iframe 元素内部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/806086/

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