Transparent half circle cut out of a div

前端 未结 8 2318
一生所求
一生所求 2020-11-22 05:34

I would like to make a transparent cut out half circle shape using only CSS3. The only requirement is that all the elements that form the shape must

8条回答
  •  难免孤独
    2020-11-22 05:54

    I needed rounded corners only on the bottom of a responsive image. I started from @sandeep fiddle and improved it for my needs:

                .rect
                {
                    height: 85vh;
                        position: relative;
                    background-color: red;
                    width: 60vw;
                }
    
                .circle-helper{
                    display: block;
                    width: 100%;
                    padding-bottom: 50%;
                    bottom: 0;
                    left: 0;
                    overflow: hidden;
                    position: absolute;
                    background-color: transparent;
    
                        }
                .circle{
                    display: block;
                    width: 100%;
                    padding-bottom: 100%;
                    // height: 500px;
                    bottom: 0;
                    left: 0;
                    overflow: hidden;
                    position: absolute;
                    background-color: transparent;
                }
    
                .circle:after{
                    box-sizing: content-box;
                    content: '';
                    width: 100%;
                    height: 100%;
                    -moz-border-radius: 50%;
                    -webkit-border-radius: 50%;
                    border-radius: 50%;
                    background: rgba(0,0,0,0);
                    position: absolute;
                    transform: translate(-50%, -50%);
                    top: 50%;
                    left: 50%;
                    border: 300px solid blue;
                    }
                    top: 50%
                    left: 50%
                    border: 300px solid blue
    

    https://jsfiddle.net/mop00j22/

提交回复
热议问题