CSS:z-index
来源:互联网 发布:美国动画产业 知乎 编辑:程序博客网 时间:2024/06/04 19:42
CSS:z-index
1、用法
z-index:决定了一个HTML元素的层叠顺序。拥有高的层叠顺序的元素总是会处于拥有层叠顺序较低的元素的前面。换句话说,z-index越高,这个元素再层叠顺序中越靠上。
注:z-index属性只能在定位元素中有效(position:absolute | relative |fixed)
2、浏览器兼容性
所有的主流浏览器都支持z-index属性。
3、例:
* {margin: 0;padding: 0;list-style: none;}.square {width: 400px;height: 200px;margin: 0 auto;position: relative;}.square ul {width: 100%;height: 100%;}.square li {width: 100%;height: 100%;position: absolute;z-index: -1;}.square li:target {z-index: 1;animation: slide 1s;}#square1 {background-color: green;}#square2 {background-color: red;}#square3 {background-color: blue;}.small {position: absolute;right: 0;bottom: 0;z-index: 2;}.small a {text-decoration: none;display: inline-block;padding: 0 6px;color: #fff;background-color: rgba(255,255,255,.5);}@keyframes slide {from {width: 0;}to {width: 400px;}}
<div class="square"> <ul> <li id="square1"></li> <li id="square2"></li> <li id="square3"></li> </ul> <div class="small"> <a href="#square1">1</a> <a href="#square2">2</a> <a href="#square3">3</a> </div> </div>
1 0
- CSS z-index
- css z-index
- css中z-index
- css:z-index
- css z-index 不起作用
- CSS z-index 属性
- CSS z-index 属性
- css z-index详解
- CSS z-index 属性
- css之z-index
- CSS z-index 属性
- CSS z-index 属性
- css:z-index总结
- CSS:z-index
- CSS z-index 属性
- CSS中的z-index属性
- css之z-index探讨
- css z-index层级关系
- 争取做一个早睡早起,有思想也有的趣程序员
- 单链表的冒泡排序以及逆序(交换指针法)
- consul部署 docker篇
- HDU_1009 FatMouse' Trade 【贪心】
- ubuntu16.04中将python3设置为默认
- CSS:z-index
- 简单排序包括冒泡排序和插入排序
- 考研英语
- 技术性图文还原那些腿长得能改变地球引力场的TB奇女子
- 希尔排序(增量排序)
- 堆排序(由选择排序引出)
- HDU_1049 Climbing Worm 【贪心】
- NYOJ55 懒省事的小明
- Android动画原理分析