Trying to create a visual effect where an image of a person appears to be partially hidden inside a container, with the bottom part concealed by overflow: hidden
. However, I want the top part of the image to extend out of the container. Is there a way to achieve this using CSS? I've considered using clip-path: polygon()
with values similar to my container's border-radius
, but haven't been successful. Any suggestions on how to approach this?
.
Here is the CSS code for reference:
.avatar--container {
border-radius: 84% 38% 70% 43% / 55% 74% 59% 71%;
background-color: var(--pink);
border: 20px solid var(--blue);
height: 15rem;
width: 25rem;
}
.avatar {
width: 35rem;
transform: translate(-10rem, -12rem);
margin-bottom: 5rem;
}
<div className="avatar--container">
<img className="avatar" src={src} alt="Rachel Hall" />
</div>