Gap between border and image when border radius is added

前端 未结 5 1379
不思量自难忘°
不思量自难忘° 2020-12-20 11:40

I have an image with a border radius of 50% and a 3px border around it. My problem is when the border radius is given, there is a 1px gap between the image and the border.

5条回答
  •  清歌不尽
    2020-12-20 11:58

    The background-color suggestion works great, but if you're in a situation where a background color would be less than ideal (for example a PNG image with a bt of transparency) then you might be able to use background-clip: border-box;

    See background-clip on MDN for more details about that property.

提交回复
热议问题