• 技术文章 >Web开发 >css教程

    css中z-index属性

    小妮浅浅小妮浅浅2021-09-23 10:15:41原创5120

    1、z-index属性值:当默认值为0时,z-index属性可以设置各元素之间的重叠关系。

    2、z-index值大的层位于其值小的层之上。

    实例

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20

    21

    22

    23

    24

    25

    26

    27

    28

    div { 

           position: relative

           width: 100px

           height: 100px

        

      p { 

           position: absolute

           font-size: 20px

           width: 100px

           height: 100px

        

     .a { 

           background-color: pink; 

           z-index: 1

        

               

     .c { 

           background-color: green

           z-index: 2

           top: 20px

           left: 20px

        

     .b { 

           background-color: red

           z-index: 3

           top: -20px

           left: 40px

            }

    以上就是css overflow属性的作用,希望对大家有所帮助。更多css学习指路:css教程

    本文教程操作环境:windows7系统、css3版,DELL G3电脑。

    专题推荐:css z-index
    上一篇:css overflow属性有什么用 下一篇:css样式的组成

    相关文章推荐

    • CSS背景颜色的表示方法• css中有哪些类型的样式表• css module解决命名冲突• css global在类名的应用• CSS设计模式之ITCSS的介绍• css边距重叠是什么• css中a标签伪类如何使用• css中背景定位有哪些方法• css首行缩进text-indent的实现• css文本修饰text-decoration的使用• css文字间距的使用• css中flex是什么• css overflow属性有什么用

    全部评论我要评论

    © 2021 Python学习网 苏ICP备2021003149号-1

  • 取消发布评论
  • 

    Python学习网