Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap Carousel Image Not Display in Full Width

I'm creating a simple HTML template using Bootstrap 3. I check the template in medium size display, it looks ok. But when I check it in larger display (and higher resolution), I see some white space at the right side of the images inside the Carousel.

Screenshot:

enter image description here

My code for the Carousel:

<!-- Carousel
================================================== -->

<div class="clearfix"></div>


    <div id="myCarousel" class="carousel slide" 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>
      </ol>
      <div class="carousel-inner">
        <div class="item active">
          <img src="img/4.jpg">
          <div class="container">
            <div class="carousel-caption">
              <h1>
                Example headline.
              </h1>
              <p>
                Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.
              </p>
              <p>
                <a class="btn btn-lg btn-primary" href="#" role="button">
                  Call to Action
                </a>
              </p>
            </div>
          </div>
        </div>
        <div class="item">
          <img src="img/5.jpg">
          <div class="container">
            <div class="carousel-caption">
              <h1>
                Another example headline.
              </h1>
              <p>
                Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.
              </p>
              <p>
                <a class="btn btn-lg btn-primary" href="#" role="button">
                  Register Now
                </a>
              </p>
            </div>
          </div>
        </div>
        <div class="item">
          <img src="img/6.jpg">
          <div class="container">
            <div class="carousel-caption">
              <h1>
                One more for good measure.
              </h1>
              <p>
                Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.
              </p>
              <p>
                <a class="btn btn-lg btn-primary" href="#" role="button">
                  Read Blog
                </a>
              </p>
            </div>
          </div>
        </div>
      </div>
      <a class="left carousel-control" href="#myCarousel" data-slide="prev">
        <span class="glyphicon glyphicon-chevron-left">
        </span>
      </a>
      <a class="right carousel-control" href="#myCarousel" data-slide="next">
        <span class="glyphicon glyphicon-chevron-right">
        </span>
      </a>
    </div>
    <!-- end #mycarousel -->

How to fix this problem?

I have try to insert container class before the Carousel class, but that not give me full width Carousel. I want the Carousel in full width, not wrapped in container class width.

like image 691
Zulhilmi Zainudin Avatar asked Jan 22 '14 05:01

Zulhilmi Zainudin


1 Answers

In your css

.carousel-inner>.item>img, .carousel-inner>.item>a>img {
display: block;
height: auto;
max-width: 100%;
line-height: 1;
width: 100%; // Add this
}
like image 103
Godinall Avatar answered Sep 30 '22 16:09

Godinall