How do I Make rounded corners on na image that already is centered?

I need Help with rounding image corners.

<p style="text-align: center;"><img src="image.png" 
     width="300" 
     height="150"/>

I assume you’re using HTML/CSS/JS? Please clarify your programming language and if possible share the link to your Repl for specific help.
Try this CSS:

img {
  border-radius: 25%;
}
1 Like
 <p style="text-align: center;"><img src="wolfden.png" 
     width="300" 
     height="150"/>
1 Like

Yup, css js HTML. Let me try that now.

1 Like

You probably want to use a standard, non-scaling unit for a border radius, like pixels (px), instead of a percentage (%).

2 Likes

Probably. I tend to play around with different units until it’s the way I want it since CSS has so many units. I think 25% will make it a circle.

1 Like

It will depend on the dimensions of the page/parent element. The page will likely be very large in proportion and hence make it a circle. I think any value greater than half the width of the object will make it a circle.

2 Likes

hmm usually I just do 100% but I think the border radius should be 50% to make a square a circle;
Here is mathematical proof (kinda i was lazy)

2 Likes


I do not know how to apply it. Im new to css

2 Likes

just go into your css file and add a property border-radius: 50%
Feel free to tweak 50% to anything you want. I usually use 10-20px for border-radius.

2 Likes

A separate CSS file is ideal but here’s how with your existing code:

<p style="text-align: center;"><img src="wolfden.png" style="border-radius: 25px;"/>
1 Like

just make sure you keep the width and the height properties. Happy coding!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.