z-index和zindex
来源:互联网 发布:平板windows系统怎么样 编辑:程序博客网 时间:2024/04/30 00:56
<html>
<head>
<style>
.z1,.z2,.z3{position:absolute;width:200px;height:100px;color:#fff;padding:5px 10pxtext-align:right;}
.z1{z-index:1;background:#000;}
.z2{z-index:4;top:30px;left:30px;background:#C00;}
.z3{z-index:5;top:60px;left:60px;background:#999;}
</style>
</head>
<body>
<div class="z1">z-index:1</div>
<div class="z2">z-index:2</div>
<div class="z3">z-index:3</div>
</body>
</html>
zindex在Js中:<html>
<head>
<style type="text/css">
#img1
{
position:absolute;
left:0px;
top:0px;
z-index:-1
}
</style>
<script type="text/javascript">
function changeStackOrder()
{
document.getElementById("img1").style.zIndex="1";
}
</script>
</head>
<body>
<h1>This is a Heading</h1>
<img id="img1" src="file:///D|/自我总结/10.jpg" width="100" height="180">
<p>Default z-index is 0. Z-index -1 has lower priority.</p>
<input type="button" onclick="changeStackOrder()"
value="Change stack order" />
</body>
</html>
总结:凡是用z-index的属性,首先应该position,也就是说如果不设置position,那么元素不能脱离普通文档流,SO,浮动起来才是道理。神马真是浮云。。
- z-index和zindex
- javascript动态改变层的Z-INDEX的代码style.zIndex
- javascript 动态改变层的Z-INDEX的代码style.zIndex
- z-index最大值和最小值
- Zindex和png
- zindex
- Z-index
- z-index
- z-index
- z-index
- z-index
- z-index
- z-index
- z-index
- z-index和position的关系
- clip和z-index的用法
- html05 overflow和z-index的用法
- z-index 的最大值和最小值
- js中eval详解
- CSS定位属性Position详解
- overflow:hidden的作用
- 【转载】js 对表格进行各种操作(转)
- MYSQL5.7版本sql_mode=only_full_group_by问题 5.7就是个坑
- z-index和zindex
- GCC主要数据结构之c_language_kind
- javascript 正则表达式入门到高级-01
- 使用MultiColumnPullToRefreshListView实现瀑布流加载网络图片
- javascript 正则表达式入门到高级-02
- javascript 正则表达式入门到高级-03
- 闭包--解析
- JS运动----(1)
- three.js解决中文乱码,终于解决了