CSS z-index paradox flower

后端 未结 6 464
遇见更好的自我
遇见更好的自我 2021-01-29 20:20

I would like to create a paradoxical effect via the z-index CSS property.

In my code I have five circles, like in the image below, and they are all absolute

6条回答
  •  囚心锁ツ
    2021-01-29 21:05

    JS Fiddle

    HTML

    1
    2
    3
    4
    5

    CSS

    .item {
        width: 50px;
        height: 50px;
        line-height: 50px;
        border: 1px solid red;
        background: silver;
        border-radius: 50%;
        text-align: center;
    }
    .item2 {
          width: 25px;
        height: 50px;
        line-height: 50px;
        border: 1px solid red;
        border-right: none;
        border-radius: 50px 0 0 50px;
        background: silver 50%;
        background-size: 25px;
        text-align: center;   
            z-index: -3;
    }
    .item3 {
        width: 25px;
        height: 50px;
        line-height: 50px;
        border: 1px solid red;
        border-left: none;
        border-radius: 0 50px 50px 0;
        background: silver 50%;
        background-size: 25px;
        text-align: center;    
    }
    .i1 {
        position: absolute;
        top: 30px;
        left: 0px;
    }
    .i2 {
        position: absolute;
        top: 0px;
        left: 35px;
    }
    .i3 {
        position: absolute;
        top: 30px;
        left: 65px;
    }
    .i4 {
        position: absolute;
        top: 70px;
        left: 55px;
    }
    .i5 {
        position: absolute;
        top: 70px;
        left: 15px;
    }
    .i5 {
        position: absolute;
        top: 72px;
        left:19px;
    
    }
    .i6 {
        position: absolute;
        top: 72px;
        left: 44px;
    }
    #five {
         position: absolute;
        top: 88px;
        left: 40px;
        z-index: 100;
    }
    

提交回复
热议问题