【发布时间】:2009-04-30 09:25:01
【问题描述】:
我的 html 代码有问题。我已经尝试了很多解决方案,但我还没有解决我的问题。 Excatly 我的问题是; 如果我在 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>
【问题讨论】:
-
您的问题到底是什么?您的代码有什么错误?
-
你用的是什么浏览器?我在 IE8 中检查了这一点,它看起来很好(两个 iframe 都正确显示了它们的内容)。
-
是否要为两个 div 元素安排中心屏幕?
-
我在页面中有两个 div。它应该在页面上显示两个 div(带有黑色标题)。当我尝试添加 而不是
-
另一方面,它显示了两个带有 iframe 的 div,但是 div 没有正确显示。