Cut out transparent circle with CSS3

后端 未结 4 1501
名媛妹妹
名媛妹妹 2020-12-21 03:52

I want to make this shape in CSS3. Is it possible? :S

\"enter

My plan is to pu

4条回答
  •  轮回少年
    2020-12-21 04:19

    The cut out circle can be made only with CSS using box-shadows. The following demo has fixed height/widths but it is possible to achive the same output with percent size and therefore make it responsive :

    DEMO

    output :

    cut out circle with CSS

    body{
        background:url(http://lorempixel.com/output/people-q-g-640-480-7.jpg);
        background-size:cover;
    }
    div{
        width:600px; height:350px;
        overflow:hidden;
        position:relative;
        margin:0 auto;
        border-top-left-radius:20px;
        border-top-right-radius:20px;
        z-index:1;
    }
    div:before,div:after{
        content:'';
        position:absolute;    
    }
    div:before{   
        top:-50px; left:225px;
        width:150px; height:150px;
        border-radius:50%;
        box-shadow: 0px 0px 0px 9999px #000;
        z-index:-1;
    }
    div:after{
        top:0;left:0;
        width:100%; height:100%;
        box-shadow: inset 0px -300px 600px -300px #fff;
    }

提交回复
热议问题