Skip to content

Instantly share code, notes, and snippets.

@chrisdlangton
Last active June 5, 2016 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisdlangton/daa2317d2c5813841d1a7c7a1ab9c38f to your computer and use it in GitHub Desktop.
Save chrisdlangton/daa2317d2c5813841d1a7c7a1ab9c38f to your computer and use it in GitHub Desktop.
Image Slider in Pure CSS
section{
width: 200px;
height: 200px;
position: relative;
left: 50%;
top: 1em;
margin-left: -100px;
overflow: hidden;
background: #292929;
border: 10px solid #fff;
}
/*section:hover article{
animation-play-state: paused;
}*/
article{
position: absolute;
left: 200px;
background: #292929;
color: #e3e3e3;
width: 200px;
height: 200px;
text-align: center;
font: 2em/1em sans-serif;
border-box: box-sizing;
padding-top: 80px;
}
article:nth-of-type(1){
animation: slideIn 50s linear 0s infinite;
}
article:nth-of-type(2){
animation: slideIn 50s linear 5s infinite;
}
article:nth-of-type(3){
animation: slideIn 50s linear 10s infinite;
}
@keyframes slideIn{
0% {left: 200px;}
1% {left: 0;}
10% {left: 0;}
11% {left: -200px;}
100%{left: -200px;}
}
<section>
<article>Slide 1</article>
<article>Slide 2</article>
<article>Slide 3</article>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment