Imagine a parent div
with a rounded border-radius
. Is there a way to fit an img
inside the div so that it also conforms to the rounded border?
.parent-div {
background-color: gray;
border-radius: 20px;
}
.image {
width: 100%
}
<div class="parent-div">
<img class="image" src="/a-cool-image">
<p>Some text</p>
</div>
This just results in an image with square corners while the div has rounded corners on the bottom. The only workaround I know is to have the image have the same border-radius property but only on the top two corners. I find that to be an annoying workaround.