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 includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML

              
                <div class="container">
  <h2>Sample Carousel</h2>
  <div id="carouselExampleControls" class="carousel slide w-50" data-ride="carousel" data-wrap="false">
    <div class="carousel-inner">
      <div class="carousel-item active">
        <div class="card p-3 h-100">
          <h3>Slide 1</h3>
          <p>
            Card with height.<br>
            Card with height.<br>
            Card with height.<br>
            Card with height.<br>
            Card with height.<br>
            Card with height.<br>
            Card with height.<br>
            Card with height.<br>
            Card with height.<br>
          </p>
        </div>
      </div>
      <div class="carousel-item">
        <div class="card p-3 h-100">
          <h3>Slide 2</h3>
          <p>
            Height is adjusted by JS to fit to max height.
          </p>
        </div>
      </div>
      <div class="carousel-item">
        <div class="card p-3 h-100">
          <h3>Slide 3</h3>
          <p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
          </p>
        </div>
      </div>
    <a class="carousel-control-prev" href="#carouselExampleControls" 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="#carouselExampleControls" role="button" data-slide="next">
      <span class="carousel-control-next-icon" aria-hidden="true"></span>
      <span class="sr-only">Next</span>
    </a>
  </div>
</div>
              
            
!

CSS

              
                [class^="carousel-control-prev-icon"],
[class^="carousel-control-next-icon"] {
  background-color: black;
}
              
            
!

JS

              
                $(function() {  
  $('.carousel').each(function() {
    // Match slides' heights
    var maxHeight = 0;
    var items = $(this).find('.carousel-item');
    items.css('height', '');
    items.each(function() {
        maxHeight = Math.max(maxHeight, $(this).height());
      });
    items.css('height', maxHeight + 'px');

    // Toggle display of prev/next buttons
    if ($(this).data('wrap') === false) {
      var first = $(this).find('.carousel-item').first();
      var last = $(this).find('.carousel-item').last();
      var prev = $(this).find('.carousel-control-prev');
      var next = $(this).find('.carousel-control-next');

      prev.toggle(!first.hasClass('active'));

      $(this).on('slid.bs.carousel', function() {
        prev.toggle(!first.hasClass('active'));
        next.toggle(!last.hasClass('active'));
      });
    }
  });
});
              
            
!
999px

Console