Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <fieldset class="slideshow">

  <!-- Slide 1 -->
  <input type="radio" id="slideCheckbox1" name="slide" checked autofocus></input>
  <div class="slide">
    <div class="slide__html">
      <!-- You can include HTML instead of a background image using .slide__html -->
    </div>
    <div class="slide__content">
      <h1>Slideshow Concept V2 (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 and label 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><strong style="color: #0F0">NEW:</strong> Arrow keys work too after your first selection.</p>
      <p>Et voila.</p>
    </div>  
  </div>

  <!-- Slide 2 -->
  <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 -->
  <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 -->
  <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 -->
  <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! -->

  <nav>
    
    <!-- Add slide labels here! -->
    
    <label class="slide-button" for="slideCheckbox1">Intro</label>
    <label class="slide-button" for="slideCheckbox2">More</label>
    <label class="slide-button" for="slideCheckbox3">Yet More</label>
    <label class="slide-button" for="slideCheckbox4">Zzz</label>
    <label class="slide-button" for="slideCheckbox5">The End</label>
  </nav>

</fieldset>

              
            
!

CSS

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

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

// Slide backgrounds (if used, must be same as number of slides, otherwise false)
$b-slides: url('https://dummyimage.com/1000x2000/2E112D/fff.png&text=Slide 1') url('https://dummyimage.com/1000x2000/540032/fff.png&text=Slide 2') url('https://dummyimage.com/1000x2000/820333/fff.png&text=Slide 3') url('https://dummyimage.com/1000x2000/C9283E/fff.png&text=Slide 4') url('https://dummyimage.com/1000x2000/F0433A/fff.png&text=Slide 5');
// $b-slides: false;

// 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-background;
  overflow: hidden;
  counter-reset: slide;
}

input {
  position: absolute;
  opacity: 0;
  top: -25px;
  counter-increment: slide;
    
  &:checked + .slide {
    transform: translateX(0px);
    transition: transform #{$animation-duration / 2} ease-in-out;
    
    .slide__content {
      width: 100%;
      display: block;
      
      &:before {
        color: #FFF;
        position: absolute;
        top: 10px;
        right: 10px;
        content: counter(slide) ' of #{$slide-count}';
        padding: 5px 10px;
        background-color: rgba(255,255,255,0.1);
        border-radius: 4px;
        text-align: right;
      }
    }
  }
  
  @for $i from 1 through $slide-count {
    &:checked:nth-of-type(#{$i}) ~ nav label:nth-child(#{$i}) {
      color: white;
    }
  }
}

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

.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: 100%;
    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;
  }
  
  @if $b-slides {
    $i: 2;
    @each $slide in $b-slides {
      &__html { display: none; }
      
      &:nth-child(#{$i}) {
        background: $slide;
        background-repeat: no-repeat;
        background-size: 100%;
        background-position: center;

        &:after {
          @include slide-popout;
        }
      }
      $i: $i + 2;
    }
  } @else {
    
    &__html {
      @include slide-popout;
    }
  }
}

nav {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 50%;
  height: 60px;
  overflow: auto;
  background-size: 100%;
  height: 60px;
  background: linear-gradient(to bottom, rgba(0,0,0,0), $c-background 10%)
}

label {
  box-sizing: border-box;
  color: $c-label-text;
  font-weight: bold;
  display: block;
  width: calc((100% / #{$slide-count}) - 2%);
  margin: 5px 1% 5px 1%;
  height: 50px;
  line-height: 50px;
  border-bottom: solid 4px $c-label-text;
  text-align: center;
  float: left;
  text-transform: uppercase;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  
  &:hover {
    cursor: pointer;
    color: #FFF;
    border-bottom: solid 4px #FFF;
  }
  
  $i: 1;
  @each $slide in $c-slides {
    &:nth-child(#{($i)}) {
      left: calc(50% + (#{$i - 1} * (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;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console