Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

            
              <div class="container">
    <p>(border colors are used to show column grid)</p>
    <h1>IMG tag based carousel</h1>
  
  
  <div class="row">
    <div class="col-md-4">
      <h2>Lorem ipsum dolor sit amet consectetur adipisicing elit.</h2>
      <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsam illo sunt odit voluptates similique ut aliquid enim dolorum reiciendis odio vero magnam asperiores eligendi, id quasi fugiat ullam reprehenderit vel.</p>
      
    </div>
    <div class="col-md-4">
      <h2>Lorem ipsum dolor sit amet consectetur adipisicing elit.</h2>
      <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsam illo sunt odit voluptates similique ut aliquid enim dolorum reiciendis odio vero magnam asperiores eligendi, id quasi fugiat ullam reprehenderit vel.</p>
      
            <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsam illo sunt odit voluptates similique ut aliquid enim dolorum reiciendis odio vero magnam asperiores eligendi, id quasi fugiat ullam reprehenderit vel.</p>
      
      
      
    </div>
    <div class="col-md-4">
        <div id="carousel-name" class="carousel slide" data-ride="carousel">
        <ol class="carousel-indicators">
          <li data-target="#carousel-name" data-slide-to="0" class="active"></li>
          <li data-target="#carousel-name" data-slide-to="1"></li>
          <li data-target="#carousel-name" data-slide-to="2"></li>
        </ol>
        <div class="carousel-inner" role="listbox">
          <div class="carousel-item active">
            <img class="d-block img-fluid" src="https://dummyimage.com/900x340/563d7c/fff&text=+" alt="First slide">
            <div class="carousel-caption d-none d-md-block">
              <h3>Carousel Slider Title</h3>
              <p>Description text to further describe the content of the slide image</p>
              <a href="" class="btn btn-primary">Call to Action</a>
            </div>
          </div>
          <div class="carousel-item">
            <img class="d-block img-fluid" src="https://dummyimage.com/900x340/563d7c/fff&text=+" alt="Second slide">
            <div class="carousel-caption d-none d-md-block">
              <h3>Carousel Slider Title</h3>
              <p>Description text to further describe the content of the slide image</p>
              <a href="" class="btn btn-primary">Call to Action</a>
            </div>
          </div>
          <div class="carousel-item">
            <img class="d-block img-fluid" src="https://dummyimage.com/900x340/563d7c/fff&text=+" alt="Third slide">
            <div class="carousel-caption d-none d-md-block">
              <h3>Carousel Slider Title</h3>
              <p>Description text to further describe the content of the slide image</p>
              <a href="" class="btn btn-primary">Call to Action</a>
            </div>
          </div>
        </div>
        <a class="carousel-control-prev" href="#carousel-name" 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-name" role="button" data-slide="next">
          <span class="carousel-control-next-icon" aria-hidden="true"></span>
          <span class="sr-only">Next</span>
        </a>
      </div>
    </div>
  </div>
  
  
  
  
  
      <h1>Background image (background-size:cover) based carousel</h1>
  
  
  <div class="row">
    <div class="col-md-4">
      <h2>Lorem ipsum dolor sit amet consectetur adipisicing elit.</h2>
      <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsam illo sunt odit voluptates similique ut aliquid enim dolorum reiciendis odio vero magnam asperiores eligendi, id quasi fugiat ullam reprehenderit vel.</p>
      
    </div>
    <div class="col-md-4">
      <h2>Lorem ipsum dolor sit amet consectetur adipisicing elit.</h2>
      <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsam illo sunt odit voluptates similique ut aliquid enim dolorum reiciendis odio vero magnam asperiores eligendi, id quasi fugiat ullam reprehenderit vel.</p>
      
            <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsam illo sunt odit voluptates similique ut aliquid enim dolorum reiciendis odio vero magnam asperiores eligendi, id quasi fugiat ullam reprehenderit vel.</p>
      
      
      
    </div>
    <div class="col-md-4">
        
      
<!--     I added a custom class on the parent so I can reuse the styles elsewhere. I added a custom class of .carousel-h100   -->
        <div id="carousel-two" class="carousel carousel-h100 slide" data-ride="carousel">
        <ol class="carousel-indicators">
          <li data-target="#carousel-two" data-slide-to="0" class="active"></li>
          <li data-target="#carousel-two" data-slide-to="1"></li>
          <li data-target="#carousel-two" data-slide-to="2"></li>
        </ol>
        <div class="carousel-inner" role="listbox">
          <div class="carousel-item active">
            
            <!-- Instead of using an img tag I used a div with a background image             -->
            <div class="carousel-img" style="background-image:url('https://dummyimage.com/500x900/563d7c/fff&text=+')"></div>
            
            
            <div class="carousel-caption d-none d-md-block">
              <h3>Carousel Slider Title</h3>
              <p>Description text to further describe the content of the slide image</p>
              <a href="" class="btn btn-primary">Call to Action</a>
            </div>
          </div>
          <div class="carousel-item">
            
            <!-- Instead of using an img tag I used a div with a background image             -->
            <div class="carousel-img" style="background-image:url('https://dummyimage.com/500x900/563d7c/fff&text=+')"></div>
            
            <div class="carousel-caption d-none d-md-block">
              <h3>Carousel Slider Title</h3>
              <p>Description text to further describe the content of the slide image</p>
              <a href="" class="btn btn-primary">Call to Action</a>
            </div>
          </div>
          <div class="carousel-item">
            
            <!-- Instead of using an img tag I used a div with a background image             -->
            <div class="carousel-img" style="background-image:url('https://dummyimage.com/500x900/563d7c/fff&text=+')"></div>
            
            
            <div class="carousel-caption d-none d-md-block">
              <h3>Carousel Slider Title</h3>
              <p>Description text to further describe the content of the slide image</p>
              <a href="" class="btn btn-primary">Call to Action</a>
            </div>
          </div>
        </div>
        <a class="carousel-control-prev" href="#carousel-two" 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-two" role="button" data-slide="next">
          <span class="carousel-control-next-icon" aria-hidden="true"></span>
          <span class="sr-only">Next</span>
        </a>
      </div>
    </div>
  </div>
  
  
  
  
  
</div>
<!-- /.container -->
            
          
!

CSS

            
              body {margin:2rem;}

.row {
  border:2px solid green;
}

.col-md-4 {
  border:4px solid orange;
}


.carousel-img {
  background-color:#ccc;
  height:100%;
  min-height:300px;
      /* Center and scale the image nicely */
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.carousel-h100, .carousel-h100 .carousel-item, .carousel-h100 .carousel-inner {
  height:100%;
}
            
          
!

JS

            
              
            
          
!
999px

Console