Jennifer
Jennifer

Reputation: 121

How to consistently scale down slider images that vary in width

How do i scale '.slick-slide img' by height. The images vary by width and so scaling the images by width would make them inconsistant porportionately.

When i try applying a dimension to a height property for '.slick-slide img' the images do not scale. Why does this not work when if i use a width property the images will scale?

https://jsfiddle.net/mbj7ckrs/8/

.slick-slide img{
 Display: block;

Margin-left: auto;
Margin-right auto;
Padding: 0;
}

Upvotes: 1

Views: 170

Answers (1)

quicklikerabbit
quicklikerabbit

Reputation: 3556

Try this:

.slick-slide img
{
    display: block;
    max-height: 10em;
}

When I apply this to the fiddle, all of the images appear to change size in a proportionate way.

Upvotes: 1

Related Questions