首页 > 其他 > 详细

定位的盒子叠放顺序z-index

时间:2018-04-08 16:27:00      阅读:210      评论:0      收藏:0      [点我收藏+]
1.正常情况,按照顺序,最后的盒子在最上面,默认z-index为0
2.当使用z-index,数字越大,越优先显示在上面
3.注意,只要定位的盒子才可以使用该方法
<body>
    <div class="box1">注意,只要定位的盒子才可以使用该方法</div>
    <div class="box2">当使用z-index,数字越大,越优先显示在上面</div>
    <div class="box3">正常情况,按照顺序,最后的盒子在最上面,默认z-index为0</div>
</body>
<style>
        .box1 {
            width: 300px;
            height: 300px;
            background: rgb(215, 230, 14);
            position: absolute;
        }
        .box2 {
            width: 300px;
            height: 300px;
            background: rgb(219, 12, 12);
            position: absolute;
            left: 100px;
            top: 100px;
            z-index: 999;
        }
        .box3 {
            width: 300px;
            height: 300px;
            background: rgb(110, 12, 223);
            position: absolute;
            left: 200px;
            top: 200px;
        }
    </style>

技术分享图片

 

定位的盒子叠放顺序z-index

原文:https://www.cnblogs.com/EricZLin/p/8745665.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!