-2

I am having an issue with a circular border leaving a minor gap between the <img> and the border. This error happens with Chrome, Safari, and Firefox that I've tested. It does not happen when border-radius is 0.

In the second image you can see a small gap between the image and the border. How can I fix this?

enter image description here

The relevant css is:

border-radius:100px;
border:6px solid #202020;

The css is on the img tag as a style attribute. The answer in this question did not work.

Here is a fiddle reproducing the problem https://jsfiddle.net/8r8zcjvh/2/

Turnip
  • 35,836
  • 15
  • 89
  • 111
Milo
  • 5,041
  • 7
  • 33
  • 59

1 Answers1

5

Add a background with the same color:

<div style="background:red">
<img src="https://pbs.twimg.com/profile_images/949374088249671680/MuxDEZpD_400x400.jpg" style="border-radius:400px;border:4px solid darkblue; background: darkblue;">
</div>
Bruno Sousa
  • 480
  • 3
  • 12