how to set shadow for round image(css)

前端 未结 10 2079
暖寄归人
暖寄归人 2020-12-31 11:52

I\'m new to shadow in css can we set shadows for round image(i mean to a circle image).

if it is possible, please give me a code for this in css. thanks in advan

10条回答
  •  无人及你
    2020-12-31 12:32

    This is impossible since CSS does not know the shape of the image contents (e.g. interpret transparency). You could make a circle with CSS3 and give a shadow, see this jsFiddle.

    div {
        background: red;
        height: 100px;
        width: 100px;
        border-radius: 50px;
        margin: 20px;
        -webkit-box-shadow: 2px 2px 5px 0px rgba(0, 0, 0, 1);
        -moz-box-shadow: 2px 2px 5px 0px rgba(0, 0, 0, 1);
        box-shadow: 2px 2px 5px 0px rgba(0, 0, 0, 1);
    }
    

提交回复
热议问题