Я бы сделал это иначе, вместо clip-path
Я рассмотрю фон в разделе заголовка, чтобы создать угловую форму, и ваше изображение будет просто скрыто позади.Затем вы просто трансформируете анимацию, и у вас не возникнет проблем с переполнением.
Я заменил 6vw
на 40px
в следующем примере:
.menu-card {
font-family: sans-serif;
color: red;
margin:40px auto;
width: 80%;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
transition: 0.3s;
border-radius:0 0 5px 5px;
max-width: 400px;
}
.menu-card:hover {
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
}
.menu-card__header {
background-color: orange;
max-height: 300px;
border-radius: 5px 5px 0 0;
text-align: center;
}
.menu-card__header-image {
transition: transform 0.5s ease-in-out;
}
.menu-card:hover .menu-card__header-image {
transform:translateY(-80px);
}
.menu-card__title {
margin:0;
padding:15px;
padding-top:40px; /* space for the triangle shape */
margin-top:-40px; /* to create the overlap with the top section (same as padding)*/
background:
/* top background will take 40px and draw a triangular shape*/
linear-gradient(to bottom right,transparent 49%,#fff 50%)top/100% 40px,
/* bottom background will take the remaining space as a rectangular shape*/
linear-gradient(#fff,#fff) bottom/100% calc(100% - 40px);
background-repeat:no-repeat;
position:relative;
text-align: center;
}
.menu-card__description {
margin:0;
padding: 0 12px 20px;
background:#fff;
position:relative;
}
<div class="menu-card">
<div class="menu-card__header">
<img src="https://picsum.photos/id/0/250/635" alt="" class="menu-card__header-image" height="400px" />
</div>
<h2 class="menu-card__title">
Lorem Ipsum
</h2>
<p class="menu-card__description">
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Corrupti, architecto. Repudiandae dolorum incidunt sint ex
</p>
</div>