当前位置:编程学习 > JS >>

CSS让一个层位于iframe、flash之上显示

CSS高级应用技巧的一个例子,让一个层位于iFrame、Flash之上显示。或许有的朋友都感觉到了,有时候网页上的Flash或者说是指定的内容与网页上的其它内容不在同一个平面上,有的被遮挡,有时候我们不想被遮挡,那该怎么办呢?很多人都是束手无策,但是真的吗?希望这个演示代码帮你找到答案。
答案:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>position显示层定位</title>
<style type="text/css">
*{font:normal 12px/120% Tahoma;}
html{ border:0;}
body{ background:#000; overflow:auto;}
#t-iframe{ background:#fff; position:relative; z-index:1;}
.box{ position:relative; background:#f7f7f7; border:solid 1px #f09; width:200px; height:200px;}
pre{ margin:0; padding:8px; color:#f09; line-height:160%;}
</style>
</head>
<body>
<div class="box" style="z-index:5; top:50px;">
<pre>
position: relative;
background: #f7f7f7;
border: solid 1px #f09;
width: 200px;
height: 200px;
z-index: 4;
top: 50px;
我在iframe上
</pre>
</div>
<iframe id="t-iframe" scrolling="no" frameborder="0" height="300" width="100%" src="/"></iframe>
<div style="position:relative; z-index:3;">
<embed height="288" width="352" wmode="opaque" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" quality="autohigh" src="http://caihong.cc/msc/fm365.swf"/>
</div>
<div class="box" style="z-index:6; top:-80px;">
<pre>
position: relative;
background: #f7f7f7;
border: solid 1px #f09;
width: 200px;
height: 200px;
z-index:6;
top:-80px;
我在FLASH上
</pre>
</div>
</body>
</html>

上一个:一个标准的网页底部导航的CSS布局代码
下一个:纯CSS实现圆角、可拖动的一个DIV模块层

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,