2012-01-28 193 views
4

我想在我的框架集上绘制DIV图层。我听说DIV可以放在<frameset>之内,但它对我不起作用。如何把DIV放在FRAMESET上?

下面的例子不工作。我甚至没有在Firebug HTML-inspector中看到DIV。

<!doctype html> 
<html> 

<head> 

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
<title>Test of frameset with div</title> 

<style type="text/css"> 
#flashContent { 
position:fixed; 
left:200px; 
bottom:200px; 
width:400px; 
height:400px; 
background-color:red; 
z-order:1000; 
} 
</style> 

</head> 

<frameset rows="*,100px" style="z-order:10"> 



<frame src="content1.html"> 
<frame src="bottom.html"> 

<div id="flashContent"> 
    Something 
</div> 


</frameset> 

</html> 
+0

的框架基本上是一个窗口对象。所有关于窗口的规则都适用于框架。一个div属于一个窗口内的文档。由于文档不能离开它的窗口,div不能离开它的窗口。您要求在浏览器级别进行控制,但您允许的只有文档级别的控制权限。 – Mhmd 2013-02-20 05:36:30

回答

7

你不能对framesets顶部位置DIVs。要实现的唯一方法是将DIV定位在iFrame之上。至少对于较新的浏览器(no IE6)。

根据你的代码示例,你必须定位您DIV绝对包括z-index属性:

#flashContent { 

    position: absolute; 
    left: 200px; 
    bottom: 200px; 
    z-index: 2; 

    width:400px; 
    height:400px; 
    background-color:red; 
}