Bootstrap 4 carousel does not work?

In the code snippet above, I included bootstrap CSS , bootstrap JS, as well as jQuery JS inside the codepen,
but it still does not work…

Why is that so?

When I copied everything into VS Code and set up a live server it worked.
VS Code snippet below.

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>test</title>
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4"
    crossorigin="anonymous">
  <link rel="stylesheet" href="style.css">

</head>

<body>

  <div id="carousel_section" class="carousel slide" data-ride="carousel">
    <!--set up indicators-->
    <ol class="carousel-indicators">
      <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
      <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
      <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
    </ol>
    <!--actuall 3 imgaes-->
    <div class="carousel-inner">
      <div class="carousel-item active">
        <img class="d-block w-100 image" src="https://res.cloudinary.com/zzrot/image/upload/v1538351660/Personal%20Portfolio%20Collection/Personal%20Portfolio%20Site%20Images/Respsonsive_Web_Design_Cert.png"
          alt="freecodecamp responsive web design cert">

      </div>
      <div class="carousel-item">
        <img class="d-block w-100" src="https://via.placeholder.com/800x400" alt="freecodecamp javascript and data structures cert">

      </div>
      <div class="carousel-item">
        <img class="d-block w-100" src="https://res.cloudinary.com/zzrot/image/upload/v1538497090/Personal%20Portfolio%20Collection/Personal%20Portfolio%20Site%20Images/Screen_Shot_2018-10-03_at_12.17.53_AM.png"
          alt="medium article I wrote">

      </div>
    </div>
    <!--previous and next button-->
    <a class="carousel-control-prev" href="#carousel_section" 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="#carousel_section" role="button" data-slide="next">
      <span class="carousel-control-next-icon" aria-hidden="true"></span>
      <span class="sr-only">Next</span>
    </a>
  </div>







  <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
    crossorigin="anonymous"></script>
  <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
    crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
    crossorigin="anonymous"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
    crossorigin="anonymous"></script>
</body>

</html>
.carousel-caption {
  color: black;
}

.image {
  object-fit: fill;
  max-height: 100%;
  height: 100%;
  border: 2px solid red;
  background: cover;
}

Make sure this JS file is a .js file

1 Like