2012-01-28 33 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; 
}