How to center the images in the Owl Carousel

后端 未结 5 1268
隐瞒了意图╮
隐瞒了意图╮ 2021-02-04 00:10

My Owl Carousel contains pictures of different width and height. How do I align them in the middle - both horizontally and vertically?

5条回答
  •  被撕碎了的回忆
    2021-02-04 00:43

    The solution with display table is OK, but for me the divs on the right and left side slides out from the container. My code is close the same, I changed the table and table-cell to block and inline-block

    .owl-stage{
      display: block !important;
    }
    
    .owl-item{
      display: inline-block;
      float: none;
      vertical-align: middle;
    }
    
    .item{
      text-align: center;
    }
    

    The result (all images has different sizes):

提交回复
热议问题