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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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='slider-container'>
  <div class='slide'><p>CSS Slider</p></div>
  <div class='slide'><p>No JavaScript</p></div>
  <div class='slide'><p>Manual Setup</p></div>
  <div class='slide'><p>Tedious to Update</p></div>
</div>

<div class='link'>
 <a href='https://codereview.stackexchange.com/questions/221167/css-image-slider-no-javascript' target='_blank'>Give feedback on CodeReview</a>
</div>
              
            
!

CSS

              
                /*  images:
https://i.imgur.com/22UymcH.jpg
https://i.imgur.com/qtwGd3b.jpg
https://i.imgur.com/UyWlZtO.jpg
https://i.imgur.com/Qxdy5Ue.jpg
https://i.imgur.com/zN8znQk.jpg
*/
 
.slider-container{
  width: 100%;
  height: 500px;
  background: red; /* to test if background shows */
  overflow: hidden;
  position: relative; /* since slides are absolute */
  box-shadow: 0 2px 10px black;
  
  animation: 0.4s 0.2s both fadeIn;
}

.slide{
  /* positioning all slides normal position to full size of slider and in view */
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;

  animation: 12s linear infinite sliderAnimation;
  /*
  animation-name: sliderAnimation;
  animation-duration: 12s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  */

  border: 20px solid #1d1e22; /* thought it looked good */
  box-sizing: border-box; /* to keep total width at 100% */

  box-shadow: inset 0 0 20px black; /* inset shadow on the slides */

  display: flex;  /* to position the text inside*/
}

.slide:first-of-type{
  /* City */
  background: no-repeat 50% 20%/cover url('https://i.imgur.com/zN8znQk.jpg');
  /* positioning for the text inside */
  justify-content: flex-end;
  align-items: flex-start;
}
.slide:nth-of-type(2){
  /* Nature Bridge */
  background: no-repeat center/cover url('https://i.imgur.com/qtwGd3b.jpg');

  /* 12s - 9s = 3s... Will start after 3s */
  animation-delay: -9s;
}

.slide:nth-of-type(3){
  /* Painting */
  background: no-repeat center/cover url('https://i.imgur.com/Qxdy5Ue.jpg');
  /* Will start after 6s */
  animation-delay: -6s;

  /* positioning for the text inside */
  justify-content: flex-end;
  align-items: center;
}
.slide:last-of-type{
  /* Coffee */
  background: no-repeat bottom/cover url('https://images.pexels.com/photos/358591/pexels-photo-358591.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500');
  /* Will start after 9s */
  animation-delay: -3s;

  /* positioning for the text inside */
  justify-content: center;
  align-items: center;
}

@keyframes sliderAnimation{
  /* 4 slides, 20% in place and 5% transition time = 100% */
  0%{transform: translateX(0); opacity: 1;} /* starts in view */
  20%{transform: translateX(0); opacity: 1;} /* stays in view */
  25%{transform: translateX(-100%); opacity: 1;} /* slides out left */
  70%{transform: translateX(-100%); opacity: 0;} /* Doesn't matter at what percent: changes to transparent so can't see it travel back across to the right. */
  71%{transform: translateX(100%); opacity: 0;} /* Doesn't matter at what percent: moves off right */
  95%{transform: translateX(100%); opacity: 1;} /* Becomes transparent and Ready to slide on from the right */
}

.slide p{
  /*style for the text*/
  margin: 5vw;
  font-size: 3vw;
  color: white;
  text-shadow: 0.1vw 0.1vw black;
  font-family: Arial Black, Georgia, Garamond, Palatino, Trebuchet MS, Verdana;
}

.slide:last-of-type p{
  /* because white text on white background */
  text-shadow: 0 0 15px black;
}
body{
  margin: 0;
  background: #3f4351;
  max-width: 100%;
}

.link{
  text-align: center;
  padding: 100px;
}

.link a{
  color: white;
}

@keyframes fadeIn{
  from{opacity: 0;}
}
              
            
!

JS

              
                
              
            
!
999px

Console