0

I am trying to shorten the height to 500px from 1000px. Since this is my first time including bootstrap I have difficulty understanding which css class affects the carousel. If you can give me tips or a guide it would be much appreciated

Code

Eduard
  • 3,395
  • 8
  • 37
  • 62
  • You can check bootstrap documentation as well. – Gamers Agenda Dec 05 '19 at 23:43
  • Or you can create a new class and define the height by yourself – Fabio Assuncao Dec 05 '19 at 23:52
  • Does this answer your question? [Bootstrap change carousel height](https://stackoverflow.com/questions/28589911/bootstrap-change-carousel-height) – Rodger Dec 06 '19 at 01:04
  • 1
    You should check for your problem before posting a question and then post what you tried and didn't work. This particular question has been asked and answered many times. https://stackoverflow.com/help/how-to-ask – Rodger Dec 06 '19 at 01:08

1 Answers1

0

This is set to a max-width of 500px.

Here it is in a Codepen, too.

$('.carousel').carousel({
  interval: 2000
})
.carousel-item {
  max-height: 500px;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.2.1/js/bootstrap.bundle.min.js"></script>



<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
  <ol class="carousel-indicators">
    <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
    <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
    <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
  </ol>
  <div class="carousel-inner">
    <div class="carousel-item active">
      <img class="d-block w-100" src="http://placeimg.com/1920/1080/1" alt="First slide">
    </div>
    <div class="carousel-item">
      <img class="d-block w-100" src="http://placeimg.com/1920/1080/2" alt="Second slide">
    </div>
    <div class="carousel-item">
      <img class="d-block w-100" src="http://placeimg.com/1920/1080/3" alt="Third slide">
    </div>
  </div>
  <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>
Millhorn
  • 2,953
  • 7
  • 39
  • 77