Carousel
Carousal is used in bootstrap to create slideshows of images on a website. It is used to cycle through a series of images and text. Significant parts of a carousal are:
Type | Description | Syntax |
---|---|---|
Slide | The content and image of each slide is defined here | .carousel .slide |
Fade | Used to add a fading effect to the transition. | .carousel-fade |
Indicators | The indicators are the little dots at the bottom of each slide. | .carousel-indicators |
Captions | Adds text associated with image to the carousal. | .carousel-captions |
Controls | Alows us to go back and forth. | .carousel-control-next|previous-icon |
Example Code:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Carousel</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
</script>
<script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js">
</script>
</head>
<body>
<center>
<h1 class="text-success">w3wiki</h1>
<h4>Bootstrap | Carousel</h4>
<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>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src=
"https://media.w3wiki.org/wp-content/cdn-uploads/20190603152813/ml_gaming.png">
</div>
<div class="item">
<img src=
"https://media.w3wiki.org/wp-content/cdn-uploads/20190528184201/gateexam.png">
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
</center>
</body>
</html>
Bootstrap Cheat Sheet – A Basic Guide to Bootstrap
Bootstrap is a free, open-source, potent CSS framework and toolkit used to create modern and responsive websites and web applications. It is the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites. Nowadays, websites are perfect for all browsers and all sizes of screens.
Contact Us