123

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. 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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

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.

            
              <div class="wrapper">

  <div class="slider">

    <input type="radio" name="slide-switches" id="slide_1" checked class="slide-switch">
    <label for="slide_1" class="slide-label">Slide Text</label>
    <!-- <div class="slide-content">
      <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/210284/61f3ypu.jpg">
    </div> -->

    <input type="radio" name="slide-switches" id="slide_2" class="slide-switch">
    <label for="slide_2" class="slide-label">Slide Image</label>
    <div class="slide-content">
      <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/210284/Q61VWzO.jpg">
    </div>

    <input type="radio" name="slide-switches" id="slide_3" class="slide-switch">
    <label for="slide_3" class="slide-label">Slide Video</label>
    <div class="slide-content">
      <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/210284/ANIJ3J7.jpg">
    </div>

    <input type="radio" name="slide-switches" id="slide_4" class="slide-switch">
    <label for="slide_4" class="slide-label">Slide Video</label>
    <div class="slide-content">
      <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/210284/I43U6q0.jpg">
    </div>

    <input type="radio" name="slide-switches" id="slide_5" class="slide-switch">
    <label for="slide_5" class="slide-label">Slide Video</label>
    <div class="slide-content last-slide">
      <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/210284/y4Y7xhD.jpg">
    </div>

    <!-- Put image for first slide here -->
    <div class="first-slide">
      <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/210284/61f3ypu.jpg">
    </div>

  </div>

</div>
            
          
!
            
              * {
  box-sizing: border-box;
}
body {
  font-family: "Open Sans";
  line-height: 1.618;
  background: #ecf0f1;
  color: #444;
}
.wrapper {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}
.slider {
  position: relative;
  margin: 2rem 0;
  display: inline-block;
  padding-bottom: 2.5rem;
}
.slide-switch {
  display: none;
}
.slide-label {
  position: absolute;
  bottom: -3rem;
  display: block;
  z-index: 5;
  height: 1rem;
  width: 1rem;
  text-indent: 1rem;
  overflow: hidden;
  background: #2980b9;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.25s;
  transform: translateX(2000%);
}
.slide-label:nth-of-type(1) {
  left: -4.5rem;
}
.slide-label:nth-of-type(2) {
  left: -3rem;
}
.slide-label:nth-of-type(3) {
  left: -1.5rem;
}
.slide-label:nth-of-type(4) {
  left: 0rem;
}
.slide-label:nth-of-type(5) {
  left: 1.5rem;
}

.slider {
  width: 600px;
  height: 400px;
}

.slide-switch:checked + .slide-label {
  background: #3498db;
}

.slide-switch:not(:checked) + .slide-label + .slide-content {
  pointer-events: none;
}

/* All the slides */
.slide-content, .first-slide {
  width: 80%;
  height: 80%;
  position: absolute;
  top: 10%;
  left: -20%;
  right: 20%;
  transition: top 1s, left 1s, right 1s, width 1s, height 1s, box-shadow 1s;
}

.slide-content img, .first-slide img {
  width: 100%;
  height: 100%;
}

/* The selected slide */
.slide-switch:checked + .slide-label + .slide-content {
  width: 100%;
  height: 100%;
  left: 0;
  right: 0;
  top: 0;
  box-shadow: 0 10px 10px 0 rgba(0,0,0,0.5);
  opacity: 1;
  z-index: 2;
}

/* The next slide in line */
.slide-switch:checked + .slide-label + .slide-content + .slide-switch + .slide-label + .slide-content {
  left: 40%;
  right: -40%;
  z-index: -1;
  opacity: 1;
}

/* All the slides that come after the one next in line */
.slide-switch:checked ~ .slide-content {
  opacity: 0;
}

/* If the first slide switch is selected, find the last slide and move it to the left */
.slide-switch:first-of-type:checked ~ .last-slide {
  top: 10%;
  left: -20%;
  right: 20% !important;
  opacity: 1 !important;
  z-index: -1;
}

/* When the first slide is selected put it up front */
.slide-switch:first-of-type:checked ~ .first-slide {
  width: 100%;
  height: 100%;
  z-index: 3;
  left: 0 !important;
  right: 0 !important;
  top: 0;
  box-shadow: 0 10px 10px 0 rgba(0,0,0,0.5);
  opacity: 1;
}

/* The next slide in line if the first slide is currently selected. */
/* This selector is to account for the first instance of .slide-content not being there */
.slide-switch:checked + .slide-label + .slide-switch + .slide-label + .slide-content {
  left: 40%;
  right: -40%;
  z-index: -1;
  opacity: 1;
}

/* Hide the first slide by default, i.e. when it's not needed */
.first-slide {
  opacity: 0;
}

/* When the second slide is selected show the first slide on its left */
.slide-switch:nth-of-type(2):checked ~ .first-slide {
  opacity: 1;
}

/* When the last slide is selected, put the first slide on its right */
.slide-switch:last-of-type:checked ~ .first-slide {
  top: 10%;
  left: 40%;
  right: -40%;
  opacity: 1;
  z-index: -1;
}

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console