Skip to content

Instantly share code, notes, and snippets.

@mnafricano
Created September 23, 2012 02:23
Show Gist options
  • Save mnafricano/3768583 to your computer and use it in GitHub Desktop.
Save mnafricano/3768583 to your computer and use it in GitHub Desktop.
Text Slider
<section>
<article> Slide 1 </article>
<article> Slide 2 </article>
<article> Slide 3 </article>
<article> Slide 4 </article>
<article> Slide 5 </article>
<article> Slide 6 </article>
<article> Slide 7 </article>
<article> Slide 8 </article>
<article> Slide 9 </article>
<article> Slide 10 </article>
</section>
html {
background: #aaa;
}
section {
width: 200px;
height: 200px;
position: relative;
left: 50%;
top: 1em;
margin-left: -100px;
overflow: hidden;
background: #292929;
border: 10px solid #fff;
}
article {
position: absolute;
left: 200px;
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;
color: hotpink;
}
article:nth-of-type(2) {
animation: slideIn 50s linear 2.5s infinite;
color: red;
}
article:nth-of-type(3) {
animation: slideIn 50s linear 5s infinite;
color: orange;
}
article:nth-of-type(4) {
animation: slideIn 50s linear 7.5s infinite;
color: yellow;
}
article:nth-of-type(5) {
animation: slideIn 50s linear 10s infinite;
color: green;
}
article:nth-of-type(6) {
animation: slideIn 50s linear 12.5s infinite;
color: blue;
}
article:nth-of-type(7) {
animation: slideIn 50s linear 15s infinite;
color: purple;
}
article:nth-of-type(8) {
animation: slideIn 50s linear 17.5s infinite;
color: brown;
}
article:nth-of-type(9) {
animation: slideIn 50s linear 20s infinite;
color: black;
}
article:nth-of-type(10) {
animation: slideIn 50s linear 22.5s infinite;
color: hotpink;
}
@keyframes slideIn {
0% {left: 200px;}
1% {left: 100;}
10% {left: 0;}
11% {left: -200px;}
100% {left: -200px;}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment