Inverted Scooped corners using CSS

后端 未结 4 1776
独厮守ぢ
独厮守ぢ 2020-12-04 03:14

I have CSS code



        
4条回答
  •  忘掉有多难
    2020-12-04 04:02

    You can create a concaved radius using the box-shadow property.

    1. This technique creates a transparant square with overflow hidden.

    2. It then creates a transparant circle with a box shadow.

    3. We then adjust the position of the circle to only view 1 quarter of it.


    SNIPPET

    #box {
      position: relative;
      width: 200px;
      height: 50px;
      background-color: blue;
      border-radius: 9999px 0 0 9999px;
      margin: 30px;
      text-align: center;
      color: #fff;
      padding-top: 10px;
    }
    
    #top,
    #bottom {
      position: absolute;
      height: 30px;
      width: 30px;
      right: 0;
      overflow: hidden;
    }
    
    #top {
      top: -30px;
    }
    
    #bottom {
      bottom: -30px;
    }
    
    #top::before,
    #bottom::before {
      content: '';
      position: absolute;
      right: 0;
      height: 200%;
      width: 200%;
      border-radius: 100%;
      box-shadow: 10px 10px 5px 100px blue;
      z-index: -1;
    }
    
    #top::before {
      top: -100%;
    }
    #box

提交回复
热议问题