Hey Guys<
I hope everyone is doing well. I’m relatively new to web development, and I’ve been working on a project to create round photo frames using CSS. However, I’ve encountered an issue that I can’t seem to solve on my own. The problem is that my round photo frames are not centering properly, and they are not filling the frame with the underlying photo as expected.
Here’s the updated CSS code I’ve been using for the round photo frames:
/* Style for round images */
.field_23 {
width: 100px; /* Adjust the width and height as needed */
height: 100px;
border-radius: 50%; /* Makes the container round */
overflow: hidden; /* Clips the container to the round shape */
display: flex;
justify-content: center;
align-items: center;
}
.field_23 img {
width: 100%;
height: 100%;
object-fit: fill; /* Stretch the image to fully cover the container */
}
I expected the above code to create round frames that center the underlying photo and fill the frame entirely. However, the photos within the frames are not centered, and they don’t fill the frame properly. Instead, they appear slightly off-center and do not occupy the entire circular frame.
I’ve tried different variations of the CSS, adjusting margins, padding, and positioning, but I haven’t been able to achieve the desired result.
Could someone please point out what I might be doing wrong or suggest improvements to the CSS code to make the photos center properly and fill the round frame completely?
Any help or guidance would be greatly appreciated! Thanks in advance for your assistance.