I want to build, something like a carousel, that you can slide using a scrollbar. In each of the slides, there's a single line of text that should be both horizontally and vertically centered.
Setting align-items: center
changes height of the parent div
.
.carousel {
width: 100%;
background-color: #dbdbdb;
overflow-y: visible;
overflow-x: auto;
white-space: nowrap;
}
.carousel .slide {
display: inline-flex;
width: 250px;
height: 150px;
margin: 10px 10px 10px 10px;
background-color: #FFF;
font-weight: bolder;
font-size: 15px;
white-space: pre-wrap;
align-items: center;
justify-content: center;
text-align: center;
text-align-last: center;
}
<div class="carousel">
<div class="slide">Lorem ipsum dolor</div>
<div class="slide">quisquam est qui dolorem ipsum quia dolor sit amet lorem ipsum</div>
<div class="slide">consectetur, adipisci</div>
</div>
Comment out the align-items
and it fits alright. How should I resolve this issue?