Bootstrap Carousal


Go to main Page

Carousal in bootstrap

A Carousal is a slideshow for elements.




How to make Carousal?

Code

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
  <style>
  /* Make the image fully responsive */
  .carousel-inner img {
    width: 100%;
    height: 100%;
  }
  </style>
</head>
<body>

    <div id="demo" class="carousel slide text-center" data-ride="carousel" >

  <!-- Indicators -->
  <ul class="carousel-indicators">
    <li data-target="#demo" data-slide-to="0" class="active"></li>
    <li data-target="#demo" data-slide-to="1"></li>
    <li data-target="#demo" data-slide-to="2"></li>
  </ul>

  <!-- The slideshow -->
  <div class="carousel-inner "  style="width: 100%;">
    <div class="carousel-item active" style="width: 100%;">
      <img  src="https://cdn.pixabay.com/photo/2016/03/27/18/54/technology-1283624__340.jpg" alt="coding 1">
    </div>
    <div class="carousel-item">
      <img src="https://cdn.pixabay.com/photo/2015/09/05/20/02/coding-924920__340.jpg" alt="coding 2">
    </div>
    <div class="carousel-item">
      <img src="https://cdn.pixabay.com/photo/2016/11/19/14/00/code-1839406__340.jpg" alt="Coding 3">
    </div>
  </div>

  <!-- Left and right controls -->
  <a class="carousel-control-prev" href="#demo" data-slide="prev">
    <span class="carousel-control-prev-icon"></span>
  </a>
  <a class="carousel-control-next" href="#demo" data-slide="next">
    <span class="carousel-control-next-icon"></span>
  </a>

</div>
  

  <a class="carousel-control-prev" href="#demo" data-slide="prev">
    <span class="carousel-control-prev-icon"></span>
  </a>
  <a class="carousel-control-next" href="#demo" data-slide="next">
    <span class="carousel-control-next-icon"></span>
  </a>
</div>

</body>
</html>





Text on Carousel slides

Code

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
  <style>
  /* Make the image fully responsive */
  .carousel-inner img {
    width: 100%;
    height: 100%;
  }
  </style>
</head>
<body>

<div id="demo" class="carousel slide text-center" data-ride="carousel" >

  <!-- Indicators -->
  <ul class="carousel-indicators">
    <li data-target="#demo" data-slide-to="0" class="active"></li>
    <li data-target="#demo" data-slide-to="1"></li>
    <li data-target="#demo" data-slide-to="2"></li>
  </ul>

  <!-- The slideshow -->
  <div class="carousel-inner "  style="width: 100%;">
    <div class="carousel-item active" style="width: 100%;">
      <img  src="https://cdn.pixabay.com/photo/2016/03/27/18/54/technology-1283624__340.jpg" alt="coding 1">
         <div class="carousel-caption">
    <h3>Code becasuse you can</h3>
    <p>Wowwwwww!</p>
  </div>
    </div>
    <div class="carousel-item">
      <img src="https://cdn.pixabay.com/photo/2015/09/05/20/02/coding-924920__340.jpg" alt="coding 2">
      <div class="carousel-caption">
    <h3>Code becasuse you can</h3>
    <p>Wowwwwww!</p>
  </div>
    </div>
    <div class="carousel-item">
      <img src="https://cdn.pixabay.com/photo/2016/11/19/14/00/code-1839406__340.jpg" alt="Coding 3">
      <div class="carousel-caption">
    <h3>Code becasuse you can</h3>
    <p>Wowwwwww!</p>
  </div>

    </div>
  </div>

</body>
</html>