Build a rectangle frame with a transparent circle using CSS only

前端 未结 4 544
半阙折子戏
半阙折子戏 2021-01-24 02:25

I need to implement a design to my webpage butI am kind of newbie with CSS.

What I am trying is to add a frame above the user picture. For example, for any size of imag

4条回答
  •  伪装坚强ぢ
    2021-01-24 02:45

    Here try this DEMO. To check transparency, try changing body color.


    .outerCont{
        height:300px;
        width:300px;
        position:relative;
        overflow:hidden;
    }
    .innerCont{
        background-color:transparent;
        border:150px solid rgb(186, 230, 255);
        border-radius:50%;
        height:200px;
        width:200px;
        overflow:hidden;
    }
    .innerCont img{
        position:absolute;
        height:80%;
        bottom:0;
        left:50%;
        -webkit-transform:translateX(-50%);
        transform:translateX(-50%);
    }
    .centerAlign{
        position:absolute;
        left:50%;
        top:50%;
        -webkit-transform:translateX(-50%) translateY(-50%);
        transform:translateX(-50%) translateY(-50%);
    }
    

提交回复
热议问题