Вы можете использовать flex, чтобы выровнять тексты по центру и позиционировать абсолютно, чтобы выровнять изображение. Css Код
#testimonials-cards-container {
position: relative;
margin: 0;
width: 95%;
margin-left: 43px;
}
.testimonials-cards {
box-shadow: 2px 4px 30px rgba(0, 0, 0, 0.25);
border-radius: 30px;
margin: 50px 26px 33px 27px;
height: 337px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#testimonials-cards-container .testimonials-cards img{
position: absolute;
top: -50%;
left: 50%;
width: 200px;
display: table;
margin: 10px auto;
transform: translate(-50%, 30%);
z-index: 2;
}
Html Код
<div class="sectionSeven">
<div id="testimonials-cards-container" class="owl-carousel owl-theme">
<div class="testimonials-cards">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a0/Circle_-_black_simple.svg/1200px-Circle_-_black_simple.svg.png
" alt="">
<h1>test</h1>
</div>
</div>
</div>
Вы можете использовать этот подход в любом месте кода. Вам больше не нужно беспокоиться о высоте или ширине контейнера.