Using Bootstrap Icons and Bootstrap 5. I had been trying to set a padding, background color, and radius circle on a Bootstrap Icon, so that there is a perfect circle background behind the icon. I tried using <i class="bi-globe-americas text-white p-3 bg-primary rounded-circle "></i> but I noticed several issues:
- The background circle isn't perfect round circle, but it's like oval
- Since
<i>is an inline element, I had to do something else so that it doesn't wrap around, but settingdisplay: inline-block;would cause this:
or display: block would cause this:
The final result I would like is something like this:



Bootstrap's ratio classes may do what you need. You can set your container div to have an aspect ratio of 1:1, and then your icon should remain a circle.
Note: I embedded the SVG icon as the snippet tool wants either a JavaScript or CSS file.
Update: if you want the background container to be round as well, you can apply a radius to the container.