0

I want the image to stretch the entire screen.

There are 2 problem that I face with this carousel.

  • Case 1. The screen is too narrow.There is a white strip at the bottom Example.

  • Case 2. The screen is too wide. The carousel indicator cannot be seen. Example.

When I add a fifth slide, no image, just make the carousel item red. Surprisingly the item spans the entire height of the screen. So now, I wonder if the item that the image is in spans the entire height of screen, and the image is set to height:100% (of the item that its in), should the image be filling the entire height of the screen as well.

.full{
  width:100%;
  height:100%;

}

.color{
  background:red;
}

html,body{height:100%;}
.carousel,.item,.active{height:100%;}
.carousel-inner{height:100%;}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  
  <div id="myCarousel" class="carousel slide fill" data-ride="carousel">
  <!-- Indicators -->
  <ol class="carousel-indicators">
    <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
    <li data-target="#myCarousel" data-slide-to="1"></li>
    <li data-target="#myCarousel" data-slide-to="2"></li>
    <li data-target="#myCarousel" data-slide-to="3"></li>
    <li data-target="#myCarousel" data-slide-to="4"></li>
  </ol>

  <!-- Wrapper for slides -->
  <div class="carousel-inner  role="listbox">
    <div class="item active">
      <img  class="full" src="https://static.pexels.com/photos/36764/marguerite-daisy-beautiful-beauty.jpg" alt="Chania" >
    </div>

    <div class="item">
      <img class="full" src="https://static.pexels.com/photos/36753/flower-purple-lical-blosso.jpg" alt="Chania">
    </div>

    <div class="item">
      <img class="full" src="https://static.pexels.com/photos/60597/dahlia-red-blossom-bloom-60597.jpeg" alt="Flower">
    </div>

    <div class="item">
      <img class="full" src="https://s-media-cache-ak0.pinimg.com/736x/ce/6e/77/ce6e7783134c1995b9c56ad9e9b96f76.jpg" alt="Flower ">
    </div>
                                                                                                                                   
   <div class="item color">
      
    </div >  
                                                                                                                                   
                                                                                </div>

  <!-- Left and right controls -->
  <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>
   
      </div>
  
</div>

  
Neil
  • 14,063
  • 3
  • 30
  • 51
  • 4
    Did you look through all the duplicate questions first? http://stackoverflow.com/questions/16350902/bootstrap-carousel-full-screen, http://stackoverflow.com/questions/14119577/how-to-make-the-image-scale-to-full-height-in-bootstrap-carousel, and many others – Carol Skelly Mar 15 '17 at 16:32
  • Possible duplicate of [How can I make Bootstrap columns all the same height?](http://stackoverflow.com/questions/19695784/how-can-i-make-bootstrap-columns-all-the-same-height) – Shawn Mehan Mar 15 '17 at 16:47
  • @ZimSystem, I saw your answer. It solves part of my problem. Now, the indicator can be seen without scrolling down. But what if I want the img in each slide to take height 100%? I add .full class to each img. But it doesn't work. – most venerable sir Mar 15 '17 at 20:40

0 Answers0