There are some topics in this case, but after tried all way, no success. I am trying to make image responsive in owl carousel 2 plugin, I used responsive
option in plugin option and I have control on number of item on desire resolution but in some resolution image not fit to parent height, the parent is view-ad-image
and it has 250px height, and I want to to all resolution, images fit to this height.
What I tried so far:
.owl-carousel .owl-item img {
display: block;
height: 250px;
min-width: 100%;
}
Result: images are stretched on some resolution, so not successfull.
.owl-carousel .owl-item img {
display: block;
height: 100%;
width: 100%;
}
Result: Also not working. still image height not fit with parent.
I provide an example on jsfiddle because you can change window width (resolution) in there, but you can't here on StackOverflow snippet. so please for test, change result frame width to see the result.
Goal:
Fit all images to parent height, and you should not see red background, if you see, it means it not responsive and not fit.
The best you can do is:
.owl-carousel .owl-item img {
display: block;
height: 100%;
width: auto;
min-width: 100%;
}
Also Need something like @Manish answer:
.owl-stage-outer * {
height:100%;
}
But I recommend you to use something like this, if you want to use this on device, you should keep parent responsive too.
#view-ad-image {
width: 100%;
height: 100%;
max-height: 250px;
overflow: hidden;
background: red;
position: relative;
}