Engo Engo - 27 days ago 6
CSS Question

How to get rid of white space between round image and border in HTML/CSS/Bootstrap?

I have 4 round images on my website. When I assign Bootstrap class

img-circle
to them, I get white border/space between my image border and the image.

How can I get rid of this?

Demo:

enter image description here

Code:



<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

<img class="img-circle" src="http://i.imgur.com/InDshke.png" width="100" height="100" style="border:4px solid #444">





https://jsfiddle.net/odt46p28/

Answer

The "white space" is the background-color of your img

Just add:

background-color:#444;

It should do the trick.

Comments