Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Daniel Silva
Daniel Silva
11,209 Points

Bootstrap 4 carousel image inconsistency

I'm creating a sample construction site. I've made a carousel however when the images slide they bounce in size. Also when the carousel is resized to mobile the images are difference heights.

<!doctype html>

<html lang="en">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Sample Construction Site</title>
    <meta name="description" content="Construction Site">
    <meta name="author" content="SitePoint">
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">

    <!-- jQuery library -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>

    <!-- Popper JS -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>

    <!-- Latest compiled JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="css/style.css">
    <nav class="navbar navbar-expand-md bg-dark navbar-dark fixed-top">
      <!-- Brand -->
      <a class="navbar-brand" href="#">Navbar</a>

      <!-- Toggler/collapsibe Button -->
      <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
        <span class="navbar-toggler-icon"></span>

      <!-- Navbar links -->
      <div class="collapse navbar-collapse" id="collapsibleNavbar">
        <ul class="navbar-nav">
          <li class="nav-item">
            <a class="nav-link" href="#">Link</a>
          <li class="nav-item">
            <a class="nav-link" href="#">Link</a>
          <li class="nav-item">
            <a class="nav-link" href="#">Link</a>
    <div id="myCarousel" class="carousel slide" data-ride="carousel">
        <!-- 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>
        <!-- Wrapper for carousel items -->
        <div class="carousel-inner">
            <div class="carousel-item active">
                <img src="images/blueprint.jpg" class="img-fluid" alt="First Slide">
            <div class="carousel-item">
                <img src="images/crane.jpg" class="img-fluid" alt="Second Slide">
            <div class="carousel-item">
                <img src="images/green_building.jpg" class="img-fluid" alt="Third Slide">
        <!-- Carousel controls -->
        <a class="carousel-control-prev" href="#myCarousel" data-slide="prev">
            <span class="carousel-control-prev-icon"></span>
        <a class="carousel-control-next" href="#myCarousel" data-slide="next">
            <span class="carousel-control-next-icon"></span>

    <div class="container-fluid"><h1>Sample Construction</h1></div>

  <script src="js/scripts.js"></script>
html, body {

.carousel {
    margin-top: 70px;

    text-align: center;
    min-height: 280px; /* Prevent carousel from being distorted if for some reason image doesn't load */