0

I have a problem where Bootstrap carousel will stretch or squish my images inside the carousel when resizing the window. It also stretches my image vertically even when width and height attributes match the size of the image.

I have tried every answer on SO without luck such as setting min-width: 100%; to the .carousel img class, so on and so forth. My code is straight from the Bootstrap website and I noticed the images inside of it does the same thing.

The weird thing is that it resizes perfectly to the window in Edge and Firefox. The images within the carousel look just as intended but opening in Chrome and Opera generates something completely different.

Any help is appreciated.

enter image description here

Lord Goderick
  • 965
  • 2
  • 14
  • 32

3 Answers3

2

I think you have specified the height for your Images.

Just make sure to keep height auto and width 100%.

.carousel img{ width:100%; height:auto;}
Akshay Bajpei
  • 196
  • 2
  • 9
2

Bootstrap 4 is still in alpha so you can expect some instability. The carousel problem is a known issue in Bootstrap 4.

https://github.com/twbs/bootstrap/issues/21611

Carol Skelly
  • 351,302
  • 90
  • 710
  • 624
0

Sounds not that smart, but use the class "img-responsive" on the img tag's?

// Your carousel code ...
<img class="img-responsive .....>
// code ...

Which is equivalent to set the max-width of image to 100%

XY L
  • 25,431
  • 14
  • 84
  • 143
Kevin Liss
  • 136
  • 1
  • 3
  • 15