Adding border on border radius image background bleed through

前端 未结 3 643
礼貌的吻别
礼貌的吻别 2021-01-17 19:10

I\'m adding a black border on images with a blue background and while doing so, it appears to add an ever so noticeable background colored outline on the INSIDE of the borde

3条回答
  •  长发绾君心
    2021-01-17 19:36

    @stvnrynlds gave an interesting answer and I wanted to test this out myself with actual code.

    I have created a snippet below with both versions for comparison.

    .test1 - uses padding with a wrapper instead of a border

    .test2 - uses border only

    .test1{
      border-radius: 50%;
      width:50px;
      height: 50px;
      padding:5px;
      background:black;
    }
    
    .test1 img{
      border-radius:50%;
    }
    
    .test2 img{
      border-radius: 50%;
      border: 5px solid black;
    }

    Zooming in 500% into the browser you can see the end results:

    enter image description here

提交回复
热议问题