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.

            
              <fieldset class="slideshow">

  <!-- Slide 1 -->
  <label class="slide-button" for="slideCheckbox1">Intro</label>
  <input type="radio" id="slideCheckbox1" name="slide" checked></input>
  <div class="slide">
    <div class="slide__content">
      <h1>Slideshow Concept (No JS)</h1>
      <p>A pure CSS and HTML slideshow concept.</p>
      <p>To add or remove slides:</p>
      <ul>
        <li>Add a new slide template in the HTML</li>
        <li>Update the <code>$slide-count</code> SCSS variable</li>
        <li>Tab colours: Update the <code>$c-slides</code> SCSS variable</li>
        <li>Slide popout images: Update the <code>$b-slides</code> SCSS variable</li>
      </ul>
      <p>Use the tabs below to change slide.</p>
      <p>Et voila.</p>
    </div>  
  </div>

  <!-- Slide 2 -->
  <label class="slide-button" for="slideCheckbox2">More</label>
  <input type="radio" id="slideCheckbox2" name="slide"></input>
  <div class="slide">
    <div class="slide__content">
      <h1>More</h1>
      <p>More here</p>
    </div> 
  </div>

  <!-- Slide 3 -->
  <label class="slide-button" for="slideCheckbox3">Yet More</label>
  <input type="radio" id="slideCheckbox3" name="slide"></input>
  <div class="slide">
    <div class="slide__content">
      <h1>Yet More</h1>
      <p>Yet more here</p>
    </div>  
  </div>

  <!-- Slide 4 -->
  <label class="slide-button" for="slideCheckbox4">Zzz</label>
  <input type="radio" id="slideCheckbox4" name="slide"></input>
  <div class="slide">
    <div class="slide__content">
      <h1>Zzz</h1>
      <p>Yada yada</p>
    </div>   
  </div>

  <!-- Slide 5 -->
  <label class="slide-button" for="slideCheckbox5">The End</label>
  <input type="radio" id="slideCheckbox5" name="slide"></input>
  <div class="slide">
    <div class="slide__content">
      <h1>The end</h1>
      <p>It's over</p>
    </div>  
  </div>

  <!-- Add more slides here! -->

</fieldset>

            
          
!
            
              // Number of slides
$slide-count: 5;

// Tab colours (must be same as number of slides)
$c-slides: #2E112D #540032 #820333 #C9283E #F0433A;

// Slide backgrounds (must be same as number of slides)
$b-slides: url('https://placehold.it/2000x2500/2E112D/fff?text=1') url('https://placehold.it/2000x2500/540032/fff?text=2') url('https://placehold.it/2000x2500/820333/fff?text=3') 
url('https://placehold.it/2000x2500/C9283E/fff?text=4') 
url('https://placehold.it/2000x2500/F0433A/fff?text=5');

// Total duration of slide animation
$animation-duration: 1s;

// Dimensions of the slides
$slide-width: 50%;
$slide-height: 100%;

// Slide content overflow (auto or hidden)
$slide-overflow: auto;

// Slide content colours
$c-black: #000;
$c-grey: #AAA;
$c-light-grey: #DDD;

// Other colours
$c-background: #101010;
$c-text: $c-light-grey;
$c-label-text: $c-grey;

/****************************************/

html, body {
  margin: 0;
  background-color: $c-background;
  font-family: sans-serif;
}

.slideshow {
  width: 100%;
  height: 100%;
  border: 0px;
  padding: 0px;
  margin: 0 auto;
  background-color: $c-black;
  overflow: hidden;
}

input {
  display: none;
  
  &:checked + .slide {
    transform: translateX(0px);
    transition: transform #{$animation-duration / 2} ease-in-out;
    
    .slide__content {
      width: 100%;
      display: block;
    }
  }
}

@mixin slide-popout {
  position: absolute;
  margin: auto;
  top: 0px;
  right: 0px;
  bottom: 0px;
  left: 0px;
  width: 100%;
  height: 100px;
}

.slide {
  transform: translateX(#{-$slide-width * 2});
  position: absolute;
  width: $slide-width;
  height: $slide-height;
  background-size: $slide-width $slide-height;
  transition: transform #{$animation-duration / 2} ease-in-out;
  
  &__content {
    box-sizing: border-box;
    height: calc(100% - 60px);
    overflow: $slide-overflow;
    padding: 50px;
    color: $c-text;
    position: absolute;
    left: 100%;
    display: none;
    animation-name: fade-in;
    animation-duration: $animation-duration;
    animation-iteration-count: 1;
    opacity: 1;
  }
  
  $i: 1;
  @each $slide in $b-slides {
    &:nth-child(#{$i * 3}) {
      background: $slide;
      background-repeat: no-repeat;
      background-size: 100%;
      background-position: center;
      
      &:after {
        @include slide-popout;
      }
    }
    $i: $i + 1;
  }
}

label {
  box-sizing: border-box;
  color: $c-label-text;
  font-weight: bold;
  display: block;
  width: calc((50% / #{$slide-count}) - 2%);
  margin: 5px 1%;
  height: 50px;
  line-height: 50px;
  border-bottom: solid 4px $c-grey;
  text-align: center;
  position: absolute;
  bottom: 5px;
  text-transform: uppercase;
  
  &:hover {
    cursor: pointer;
    color: #FFF;
    border-bottom: solid 4px #FFF;
  }
  
  $i: 0;
  @each $slide in $c-slides {
    &:nth-child(#{($i * 3) + 1}) {
      left: calc(50% + (#{$i} * (50% / #{$slide-count})));
      border-bottom-color: $slide;
    }
    $i: $i + 1;
  }
}

@keyframes fade-in {
  0% {
    opacity: 0;
  }
  50% {
    transform: translateY(-50px);
    opacity: 0;
  }
  100% {
    transform: translateY(0px);
    opacity: 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