Resize Carousel Bootstrap 4

- 1 answer

I'm not able to resize the carousel height. I would like that the carousel won't use image height but another height that i decide, tried different css rules but withouth success.

<link rel="stylesheet" target="_blank" rel="nofollow noreferrer" href="" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<section id="portfolio" class="page-section">
      <div id="reviews" class="container-fluid">
        <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
          <ol class="carousel-indicators">
            <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
          <div class="carousel-inner">
            <div class="carousel-item active">
              <img src="" alt="...">
              <div class="carousel-caption d-none d-md-block">
          <a class="carousel-control-prev" target="_blank" rel="nofollow noreferrer" href="#carouselExampleIndicators" role="button" data-slide="prev">
            <span class="carousel-control-prev-icon" aria-hidden="true"></span>
            <span class="sr-only">Previous</span>
          <a class="carousel-control-next" target="_blank" rel="nofollow noreferrer" href="#carouselExampleIndicators" role="button" data-slide="next">
            <span class="carousel-control-next-icon" aria-hidden="true"></span>
            <span class="sr-only">Next</span>

There is a JSFiddle if could help.



Short answer:

You forgot to add img-fluid to your images. Plus, normally you should set carousel width, not height. If you want to set it's height, see Complete answer.

Complete answer:

( You can view working code here : Fiddle )

First, You should add .img-fluid to your images in carousel, if you want it to be responsive.

Second, Normally you should set width of carousel in bootstrap. it works as you can see here : Fiddle (But still it's not perfect.)

But if you want to set the height of carousel, you can change some bootstrap styles:

.carousel-inner img {
  height: 100%;
  width: auto;

.carousel-item {
  text-align: center;

then you can set carousel's height :

.carousel {
  height: 200px;

You can view this here : Fiddle

This will not crop images. if you want images to cover instead (and also cropped), you can use:

.carousel-inner img {
  width: 100%;
  height: auto;

you can see it here: Fiddle

Also , you can use media queries to customize it as well.

And last, you should refrence to jquery and bootstrap.js if you didn't already.