Owl Carousel align each item vertically when their height not equal

大兔子大兔子 提交于 2020-01-01 18:19:14

问题


I am working on a really simple Html/Boostrap website. I am using the owl-carousel library to display and slide multiple paragraphs. The problem is that when displaying on small devices, these paragraphs will not have the same height, depending on how long they are.

I would like all my owl-item div or paragraph to be aligned vertically within the owl-wrapper div. I tried few display combinations, and also the owl carousel's autoHeight: true option but it does not work as I except.

See the pictures, the little paragraph is displayed on the top of the owl-wrapper div, but I would like it to be centered vertically :

<div class="container">
  <div class="caption text-center text-white" data-stellar-ratio="0.7">
    <div id="owl-intro-text" class="owl-carousel">
      <div class="item">
        <h1>Oscar Götting</h1>
      </div>
      <div class="item">
        <h1>Let's build something together</h1>
      </div>
    </div>
  </div>
</div>

回答1:


Add this to your CSS

.owl-carousel .owl-stage { display: flex; align-items: center; }


来源:https://stackoverflow.com/questions/39320305/owl-carousel-align-each-item-vertically-when-their-height-not-equal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!