kenwheeler / slick

the last carousel you'll ever need
kenwheeler.github.io/slick
MIT License
28.47k stars 5.89k forks source link

height mismatch for slide with image. #3509

Open solugebefola opened 6 years ago

solugebefola commented 6 years ago

Adding an image to the slide with width: 100% results in a miscalculated slide height. The slick-list classed div is slightly taller than the image.

[ http://jsfiddle.net/rxnbpv35/ ]

use this jsfiddle to reproduce your bug: http://jsfiddle.net/simeydotme/fmo50w7n/ we will likely close your issue without it.

====================================================================

Steps to reproduce the problem

  1. Add image to slide div within overall slider div.
  2. Set CSS image width: 100%

====================================================================

What is the expected behaviour?

.slick-slide div height is equal to image height.

====================================================================

What is observed behaviour?

slick-slide height is slightly bigger than div height

====================================================================

More Details

devjah commented 4 years ago

You probably need to add vertical-align: middle; to the img

RZsam commented 3 years ago

I had the same problem with react-slick. div outside the img was taller and I couldn't find out why. this issue worked for me add line-height: 0 to .slick-track