Pen Settings



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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


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


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.


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.


                <div data-interaction="carousel">
  	<div class="carousel-header">
			<a href="#" class="car-btn current"></a>
			<a href="#" class="car-btn"></a>
			<a href="#" class="car-btn"></a>
			<a href="#" class="car-btn"></a>
		<div id="carousel" class="carousel">
			<div class="car-content slide1">
				  Slide 1
      <div class="car-content slide2">
  			  Slide 2
      <div class="car-content slide3">
  			  Slide 3
      <div class="car-content slide4">
  			  Slide 4


                @import "compass/css3";

// The header section. This just positions the buttons - not necassary for it to work
.carousel-header {
  padding: .6rem;
	display: block;
	width: 100%;
	height: 1.7rem;
.car-btn {
	height: 12px;
	width: 12px;
	display: inline-block;
  background-color: hotpink;
  border: 1px solid shade(hotpink, 20%);
	margin-right: 5px;
	border-radius: 50%;
// Add some style for if a button is the current one
.car-btn.current {
	background-color: aquamarine;
// The wrapping element is a table - width gets re-set by JS
.carousel {
	display: table;
	overflow: hidden;
	width: 400%;
	@include single-transition(margin-left, .3s);
// Each 'slide' is a table-cell - width gets re-set by JS
.car-content {
	display: table-cell;
	width: 25%;
  height: 300px;
@for $i from 1 through 4 {
     .slide#{$i} {
           background-color: darken(complement(adjust-hue(hotpink,
   ($i * 10%))), 10%);


                    // ====================================================================
// Carousel
// ====================================================================
$('[data-interaction*="carousel"]').on('click', function() {
  var indexPosition = $(this).index();
	var slideCount = ($(this).length + $(this).siblings().length);
	var marginToMove = (indexPosition * -100)+'%';
	var slideWidth = (100 / slideCount)+'%';
	$('#carousel').css({'margin-left': marginToMove, 'width': (slideCount * 100)+'%'});
	$('.car-content').css('width', slideWidth);