1

I want to make an image round (circle) from CSS, but, when I use border-radius: 50%; my image goes ellipsoidal.

I expect to output a responsive circle with that image.

How I can do that?

Thanks!

#image {
  width: 100%;
  border-radius: 50%;
}
<div id="main">
  
  <figure id="img-div">
    <img id="image" src="https://wallpaperaccess.com/full/486693.jpg" alt="A bulb that represent electricity">
  </figure>
  
</div>

3
  • 3
    You should have height and width of the image same to have a circle Commented Sep 12, 2019 at 14:02
  • Ok, but then the image will be no more responsive, right? Commented Sep 12, 2019 at 14:04
  • stackoverflow.com/questions/15167545/… Check this to obtain the square image. Commented Sep 12, 2019 at 14:05

3 Answers 3

1

You can do it by resizing your image just make your image same height and width like below..

this is only another way you can do it..

#image {
  width: 100%;
  border-radius: 50%;
}
<div id="main">
  
  <figure id="img-div">
    <img id="image" src="https://i.sstatic.net/q2ola.jpg" alt="A bulb that represent electricity">
  </figure>
  
</div>

Sign up to request clarification or add additional context in comments.

1 Comment

The image must be a square, I undestand. Thanks!
1

You need to set the same height and width in order for an element to be a circle.

#image {
  width: 150px;
  height: 150px;
  border-radius: 50%;
}
<div id="main">
  
  <figure id="img-div">
    <img id="image" src="https://wallpaperaccess.com/full/486693.jpg" alt="A bulb that represent electricity">
  </figure>
  
</div>

1 Comment

Ok, I got this, but now the image will be no more responsive, right? I want to keep that circle image responsive.
1

Your image needs to be square to obtain this result.

You can use this : How to "crop" a rectangular image into a square with CSS? to keep it square and responsive.

After that, you radius will make it circle.

1 Comment

Don't hesitate to set it as an answer if this solved your issue. And no problem :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.