Owlcarousel2: How to get same height for all the images in the owl-carousel?

Created on 27 Jan 2018  路  5Comments  路  Source: OwlCarousel2/OwlCarousel2

Some of my images are of 250px height some are 100 px.. How to adjust height to all images as same.?

Most helpful comment

You can set owl-stage display as flexbox and then apply height 100% on images

.owl-carousel .owl-stage {
    display: flex;
}

.owl-carousel .owl-item img {
    width: auto;
    height: 100%;
}

All 5 comments

did you try applying a img { height: 100% } and div.image-wrapper{ height: 100px} to the wrapping div?

You can set owl-stage display as flexbox and then apply height 100% on images

.owl-carousel .owl-stage {
    display: flex;
}

.owl-carousel .owl-item img {
    width: auto;
    height: 100%;
}

(Sorry about the canned reply.)
I'm sorry but this seems not be an "issue" related to the OwlCarousel project. Please go to a site like http://stackoverflow.com/ and get help by the community.

To maintain aspect ratio as well as setting height use below code

.owl-carousel .owl-wrapper {
    display: flex !important;
}
.owl-carousel .owl-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-width: initial;
}

Sorry guys but where do I should set the image height?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Uranbold picture Uranbold  路  3Comments

unite4 picture unite4  路  4Comments

siwel picture siwel  路  3Comments

shamimsaj picture shamimsaj  路  3Comments

SimonHarte picture SimonHarte  路  3Comments