box-shadow and border rendering bug

前端 未结 1 1585
难免孤独
难免孤独 2020-12-11 07:13

Css causing the \"bug\":

div {
    width: 100px;
    height: 100px;
    background-color: transparent;
    box-shadow: 0 0 15px 20px #000 in         


        
1条回答
  •  春和景丽
    2020-12-11 07:57

    Definitely looks like a bug in box-shadow (when using the spread arg). As a work-around just use an overlay div. Here's the code:

    html:

    css:

    div {
        margin:10px;
        width: 100px;
        height: 100px;
        background-color: transparent;
        box-shadow: 0 0 15px 20px #000 inset;
        border: 100px solid #000 ;
        border-radius: 150px;
    }
    div.overlay {
        margin-top:-310px;
    }
    

    Here's the fiddle: http://jsfiddle.net/eX3cy/1/

    Edit:

    Here's a fiddle with the blur and spread adjusted as well (to show that identical results, minus the unwanted parts, can be achieved): http://jsfiddle.net/wgpzL/

    0 讨论(0)
提交回复
热议问题