Created
October 17, 2015 17:27
-
-
Save alfchee/e67b806fbe5487fa8a5d to your computer and use it in GitHub Desktop.
Demo of a Slider only with CSS3, nothing of JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Slider CSS</title> | |
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> | |
<!--[if gte IE 9]> | |
<style type="text/css"> | |
.gradient { | |
filter: none; | |
} | |
</style> | |
<![endif]--> | |
<!-- WARNING: Respond.js doesn't work if you view the page via file:// --> | |
<!--[if lt IE 9]> | |
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> | |
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> | |
<![endif]--> | |
<style type="text/css"> | |
@import url(http://fonts.googleapis.com/css?family=Istok+Web); | |
@keyframes slidy { | |
0% { left: 0%; } | |
20% { left: 0%; } | |
25% { left: -100%; } | |
45% { left: -100%; } | |
50% { left: -200%; } | |
70% { left: -200%; } | |
75% { left: -300%; } | |
95% { left: -300%; } | |
100% { left: -400%; } | |
} | |
body, figure { | |
margin: 0; background: #101010; | |
font-family: Istok Web, sans-serif; | |
font-weight: 100; | |
} | |
div#captioned-gallery { | |
width: 100%; overflow: hidden; | |
} | |
figure.slider { | |
position: relative; width: 500%; | |
font-size: 0; animation: 30s slidy infinite; | |
} | |
figure.slider figure { | |
width: 20%; height: auto; | |
display: inline-block; position: inherit; | |
} | |
figure.slider img { width: 100%; height: auto; } | |
figure.slider figure figcaption { | |
position: absolute; bottom: 0; | |
background: rgba(0,0,0,0.4); | |
color: #fff; width: 100%; | |
font-size: 2rem; padding: .6rem; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="captioned-gallery"> | |
<figure class="slider"> | |
<figure> | |
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/hobbiton-lake.jpg" alt> | |
<figcaption>Hobbiton, New Zealand</figcaption> | |
</figure> | |
<figure> | |
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/wanaka-drowned-tree.jpg" alt> | |
<figcaption>Wanaka, New Zealand</figcaption> | |
</figure> | |
<figure> | |
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/utah-peak.jpg" alt> | |
<figcaption>Utah, United States</figcaption> | |
</figure> | |
<figure> | |
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/bryce-canyon-utah.jpg" alt> | |
<figcaption>Bryce Canyon, Utah, United States</figcaption> | |
</figure> | |
<figure> | |
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/hobbiton-lake.jpg" alt> | |
<figcaption>Hobbiton, New Zealand</figcaption> | |
</figure> | |
</figure> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thx