Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bootstrap 4 carousel caption is not visible on small devices

I was practicing bootstrap 4 carousal example given in http://v4-alpha.getbootstrap.com/examples/ . carousal caption is not visible when testing it for mobile or small screen. Any help please.

 <div id="myCarousel" class="carousel slide" data-ride="carousel">
 <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" role="listbox">
 <div class="carousel-item active">
 <img class="first-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="First slide">
 <div class="container">
 <div class="carousel-caption d-none d-md-block text-left">
 <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">Sign up today</a></p>
 </div>
 </div>
 </div>
 <div class="carousel-item">
 <img class="second-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Second slide">
 <div class="container">
 <div class="carousel-caption d-none d-md-block">
 <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">Learn more</a></p>
 </div>
 </div>
 </div>
 <div class="carousel-item">
 <img class="third-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Third slide">
 <div class="container">
 <div class="carousel-caption d-none d-md-block text-right">
 <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">Browse gallery</a></p>
 </div>
 </div>
 </div>
 </div>
 <a class="carousel-control-prev" href="#myCarousel" 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="#myCarousel" role="button" data-slide="next">
 <span class="carousel-control-next-icon" aria-hidden="true"></span>
 <span class="sr-only">Next</span>
 </a>
 </div>
like image 398
kuldeep singh Avatar asked Feb 25 '17 03:02

kuldeep singh


People also ask

How do you write a carousel caption?

Add captions to carousel images and set transition speed: To add a caption, hover over any image, click the “Add text” button, and select “Add caption”. To specify a transition speed for image carousels that auto-start, go to Settings > Transition speed and select an option from the dropdown menu.

Why is Bootstrap Carousel not sliding?

In browsers where the Page Visibility API is supported, the carousel will avoid sliding when the webpage is not visible to the user (such as when the browser tab is inactive, the browser window is minimized, etc.).


3 Answers

Remove the classes d-none d-md-block from all of the carousel-caption classes, the class d-none gives the caption a display of none and the class d-md-block gives it a display of block for md and above screens.

Note: you may need to adjust the text size on smaller screens to make everything fit if you have a lot of text in your captions.

like image 140
Steve K Avatar answered Oct 19 '22 08:10

Steve K


Here's what you ought to do:

  1. Remove class d-none.
  2. Remove class d-md-block.

associated with the carousel-caption class of Bootstrap carousel.

like image 39
Tahir77667 Avatar answered Oct 19 '22 07:10

Tahir77667


Actually, just removing the class "d-none" will do it for you.

like image 1
user13564417 Avatar answered Oct 19 '22 08:10

user13564417