美文网首页
层级背景

层级背景

作者: 宠着我家刘蕊 | 来源:发表于2018-12-12 09:41 被阅读0次

.box1{

    width: 200px;

    height: 200px;

    background-color: #0bcd96;

    position:relative;

    z-index:3;

}

.box2{

    width: 200px;

    height: 200px;

    background-color: #1e389a;

    position: absolute;

    left: 100px;

    top: 100px;

}

.box3{

    width: 200px;

    height: 200px;

    background-color: #6a1752;

    position: relative;

    z-index:2;

}

如果没有开启定位的元素或者是定位为默认值,会忽略z-index的声明

父元素的层级再怎么高也不会盖住子元素,可以理解为(水涨船高)

opacity(透明)

.box1{

      width: 200px;

      height: 200px;

      background-color: #0bcd96;

      position:relative;

      opacity: 50%;

      filter: alpha(opacity=50);

  }

  .box2{

      width: 200px;

      height: 200px;

      background-color: #1e389a;

      position: absolute;

      left: 100px;

      top: 100px;

      opacity:0.5px;

      filter: alpha(opacity=50);

  }

  .box3{

      width: 200px;

      height: 200px;

      background-color: #6a1752;

      position: relative;

      opacity: 50%;

      filter: alpha(opacity=50);

  }

背景(background-image)

.box1{

    width: 500px;

    height: 500px;

    margin:0 auto;

    background-color: #0bcd96;

    background-image: url(../css/logo_new@2x.png);

    background-repeat:no-repeat;

}

相关文章

  • 层级背景

    z-index 如果没有开启定位的元素或者是定位为默认值,会忽略z-index的声明 父元素的层级再怎么高也不会盖...

  • 层级背景

    如果没有开启定位的元素或者是定位为默认值,会忽略z-index的声明父元素的层级再怎么高也不会盖住子元素 opac...

  • 层级 背景

    如果没有开启定位的元素或者是定位为默认值,会忽略z-index的声明父元素的层级再怎么高也不会盖住子元素,可以理解...

  • 层级背景

    .box1{ width: 200px; height: 200px; background-colo...

  • 层级和背景

    z-index opacity(透明) 背景(background-image)

  • HTML 日常了解6

    固定定位 元素的层级 背景 背景偏移与定位 背景固定

  • 元素层级 背景 表格

    元素的层级 z-index 父元素层级在高,也不会盖住它的子元素 对于没有开启定位的元素不能使用z-index 如...

  • 元素层级、背景、表格

    元素层级 想要设置元素层级必须要开启定位(上一章有定位的描述) 后面的数字是设置层级的数字越大层级越高,但是父类的...

  • 匀速层级和背景

    z-index 如果没有开启定位的元素或者是定位为默认值,会忽略z-index的声明 父元素的层级再怎么高也不会盖...

  • 元素层级和背景

    元素的层级 z-index 设立层级 没有开启,是不能使用z-index 子元素层级再高也永远盖不住父元素 元素的...

网友评论

      本文标题:层级背景

      本文链接:https://www.haomeiwen.com/subject/srhuhqtx.html