I'm trying to get this CSS alternative for a slide show animation for customer Testimonials. I can get it to work in IE and Firefox but it will not work in Chrome. Does anybody know if i need to use some prefixes to fix this issue?
Here is a Demo.
<div class="css-slideshow">
<figure>
<img src="http://www.offsetprinting.com/img/custom_images/test_slide1.jpg" alt="class-header-css3" width="1192" height="497" class="alignnone size-full wp-image-172" /><figcaption><strong>CSS3:</strong></figcaption>
</figure>
<figure>
<img src="http://www.offsetprinting.com/img/custom_images/test_slide2.jpg" alt="class-header-semantics" width="1192" height="497" class="alignnone size-full wp-image-179" /><figcaption><strong>Semantics:</strong></figcaption>
</figure>
<figure>
<img src="http://www.offsetprinting.com/img/custom_images/test_slide3.jpg" alt="class-header-offline" width="1192" height="497" class="alignnone size-large wp-image-178" /><figcaption><strong>Offline & Storage:</strong></figcaption>
</figure>
<figure>
<img src="http://www.offsetprinting.com/img/custom_images/test_slide1.jpg" alt="class-header-device" width="1192" height="497" class="alignnone size-full wp-image-177" /><figcaption><strong>Device Access:</strong></figcaption>
</figure>
<figure>
<img src="http://www.offsetprinting.com/img/custom_images/test_slide2.jpg" alt="class-header-connectivity" width="1192" height="497" class="alignnone size-large wp-image-176" /><figcaption><strong>Connectivity:</strong></figcaption>
</figure>
<figure>
<img src="http://www.offsetprinting.com/img/custom_images/test_slide3.jpg" alt="class-header-multimedia" width="1192" height="497" class="alignnone size-large wp-image-175" /><figcaption><strong>Multimedia:</strong></figcaption>
</figure>
<figure>
<img src="http://www.offsetprinting.com/img/custom_images/test_slide1.jpg" alt="class-header-3d" width="1192" height="497" class="alignnone size-large wp-image-174" /><figcaption><strong>3D, Graphics & Effects:</strong></figcaption>
</figure>
<figure>
<img src="http://www.offsetprinting.com/img/custom_images/test_slide2.jpg" alt="class-header-performance" width="1192" height="497" class="alignnone size-large wp-image-173" /><figcaption><strong>Performance & Integration:</strong></figcaption>
</figure>
</div>
body{
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
}
.css-slideshow{
position: relative;
max-width: 1192px;
height: 497px;
margin: 5em auto .5em auto;
}
.css-slideshow figure{
margin: 0;
max-width: 1192px;
height: 497px;
background: #000;
position: absolute;
}
.css-slideshow img{
box-shadow: 0 0 2px #666;
}
.css-slideshow figcaption{
position: absolute;
top: 0;
color: #fff;
background: rgba(0,0,0, .3);
font-size: .8em;
padding: 8px 12px;
opacity: 0;
transition: opacity .5s;
}
.css-slideshow-attr{
max-width: 1192px;
text-align: right;
font-size: .7em;
font-style: italic;
margin:0 auto;
}
.css-slideshow-attr a{
color: #666;
}
.css-slideshow figure{
opacity:0;
}
figure:nth-child(1) {
animation: xfade 48s 42s infinite;
}
figure:nth-child(2) {
animation: xfade 48s 36s infinite;
}
figure:nth-child(3) {
animation: xfade 48s 30s infinite;
}
figure:nth-child(4) {
animation: xfade 48s 24s infinite;
}
figure:nth-child(5) {
animation: xfade 48s 18s infinite;
}
figure:nth-child(6) {
animation: xfade 48s 12s infinite;
}
figure:nth-child(7) {
animation: xfade 48s 6s infinite;
}
figure:nth-child(8) {
animation: xfade 48s 0s infinite;
}
#keyframes xfade{
0%{
opacity: 1;
}
10.5% {
opacity: 1;
}
12.5%{
opacity: 0;
}
98% {
opacity: 0;
}
100% {
opacity: 1;
}
}
</
Chrome is a webkit browser, try using the webkit prefix (http://www.w3schools.com/cssref/css3_pr_animation-keyframes.asp) like this:
figure:nth-child(8) {
animation: xfade 48s 0s infinite;
-webkit-animation: xfade 48s 0s infinite;
}
#-webkit-keyframes xfade{
0%{
opacity: 1;
}
10.5% {
opacity: 1;
}
12.5%{
opacity: 0;
}
98% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#keyframes xfade{
0%{
opacity: 1;
}
10.5% {
opacity: 1;
}
12.5%{
opacity: 0;
}
98% {
opacity: 0;
}
100% {
opacity: 1;
}
}
Related
I linking the style css in my html code and on all HTML editors my code is working absolutely fine except on my site.
Requirement: Hyperlinked images should scroll horizontally.
Expected output: All the images are hyperlinked, and when the page is opened they start scroll automatically.
Actual output: all the images are hyperlinked but the images are linked vertically on my page. On all editors i see the images scrolling.
The website is a wordpress website
Here is my code snippet. CSS source : designshack.com
<!DOCTYPE html>
<html>
<head>
<style>
{margin: 0; padding: 0;}
body {
background: url('dark_geometric.png');
}
#container {
width: 1000px;
overflow: hidden;
margin: 50px auto;
background: white;
}
/*header*/
header {
width: 800px;
margin: 40px auto;
}
header h1 {
text-align: center;
font: 100 60px/1.5 Helvetica, Verdana, sans-serif;
}
header p {
font: 100 15px/1.5 Helvetica, Verdana, sans-serif;
text-align: justify;
}
/*photobanner*/
.photobanner {
height: 233px;
width: 3550px;
margin-bottom: 80px;
}
/*keyframe animations*/
.first {
-webkit-animation: bannermove 30s linear infinite;
-moz-animation: bannermove 30s linear infinite;
-ms-animation: bannermove 30s linear infinite;
-o-animation: bannermove 30s linear infinite;
animation: bannermove 30s linear infinite;
}
#keyframes bannermove {
0% {
margin-left: 0;
}
100% {
margin-left: -2125px;
}
}
#-moz-keyframes bannermove {
0% {
margin-left: 0;
}
100% {
margin-left: -2125px;
}
}
#-webkit-keyframes bannermove {
0% {
margin-left: 0;
}
100% {
margin-left: -2125px;
}
}
#-ms-keyframes bannermove {
0% {
margin-left: 0;
}
100% {
margin-left: -2125px;
}
}
#-o-keyframes bannermove {
0% {
margin-left: 0;
}
100% {
margin-left: -2125px;
}
}
.photobanner {
height: 233px;
width: 3550px;
margin-bottom: 80px;
}
.photobanner img {
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
-o-transition: all .5s ease;
-ms-transition: all .5s ease;
transition: all .5s ease;
}
.photobanner img:hover {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-o-transform: scale(1.1);
-ms-transform: scale(1.1);
transform: scale(1.1);
cursor: pointer;
-webkit-box-shadow: 0 3px 5px rgba(0,0,0,0.2);
-moz-box-shadow: 0 3px 5px rgba(0,0,0,0.2);
box-shadow: 0 3px 5px rgba(0,0,0,0.2);
}
</style>
</head>
<body>
<div class="photobanner">
<a href="mysite">
<img class="first" src="me.jpg" alt="" /> </a>
<a href="site"
<img src="ns.jpg" alt="" /></a>
<a href="mysite"
<img src="gu.jpg" alt="" /></a>
<a href="mysite"
<img src="ri.jpg" alt="" /></a>
<a href="mysite"
<img src="me.jpg" alt="" /></a>
<a href="mysite"
<img src="ns.jpg" alt="" /></a>
<a href="mysite"
<img src="gu.jpg" alt="" /></a>
<a href="mysite"
<img src="ri.jpg" alt="" /></a>
</div>
</body>
</html>
Fix your html syntax first?:
<div class="photobanner">
<a href="mysite">
<img class="first" src="me.jpg" alt="" />
</a>
<a href="site">
<img src="ns.jpg" alt="" />
</a>
<a href="mysite">
<img src="gu.jpg" alt="" />
</a>
<a href="mysite">
<img src="ri.jpg" alt="" />
</a>
<a href="mysite">
<img src="me.jpg" alt="" />
</a>
<a href="mysite">
<img src="ns.jpg" alt="" />
</a>
<a href="mysite">
<img src="gu.jpg" alt="" />
</a>
<a href="mysite">
<img src="ri.jpg" alt="" />
</a>
</div>
Hello I am creating an HTML and CSS slideshow with four sets of images that have four pictures in each. It works perfectly on the first cycle, but after that the images start disappearing and reappearing in strange timings. I have created a JSFiddle to illustrate what I mean..... https://jsfiddle.net/mattmega4/12Lt9yhh/
<figure>
<img src="assets/fourBackgrounds/goal.jpg" width="45%" height="auto"
/>
</figure>
<figure>
<img src="assets/fourBackgrounds/soldierCat.jpg" width="45%"
height="auto" />
</figure>
</div>
<div class="css-slideshow1">
<figure>
<img src="assets/fourBackgrounds/Cyrus.jpg" width="45%" height="auto"
/>
</figure>
<figure>
<img src="assets/fourBackgrounds/fire.jpg" width="45%" height="auto"
/>
</figure>
<figure>
<img src="assets/fourBackgrounds/goal.jpg" width="45%" height="auto"
/>
</figure>
<figure>
<img src="assets/fourBackgrounds/soldierCat.jpg" width="45%"
height="auto" />
</figure>
</div>
<div class="css-slideshow2">
<figure>
<img src="assets/fourBackgrounds/Cyrus.jpg" width="45%" height="auto"
/>
</figure>
<figure>
<img src="assets/fourBackgrounds/fire.jpg" width="45%" height="auto"
/>
</figure>
<figure>
<img src="assets/fourBackgrounds/goal.jpg" width="45%" height="auto"
/>
</figure>
<figure>
<img src="assets/fourBackgrounds/soldierCat.jpg" width="45%"
height="auto" />
</figure>
</div>
<div class="css-slideshow3">
<figure>
<img src="assets/fourBackgrounds/Cyrus.jpg" width="45%"
height="auto" />
</figure>
<figure>
<img src="assets/fourBackgrounds/fire.jpg" width="45%" height="auto"
/>
</figure>
<figure>
<img src="assets/fourBackgrounds/goal.jpg" width="45%" height="auto"
/>
</figure>
<figure>
<img src="assets/fourBackgrounds/soldierCat.jpg" width="45%"
height="auto" />
</figure>
</div>
</div>
.css-slideshow {
position: relative;
width: 100%;
height: auto;
}
.css-slideshow figure {
margin: 0;
width: 100%;
height: auto;
position: absolute;
}
.css-slideshow img {
-webkit-box-shadow: 0 0 2px #666;
box-shadow: 0 0 2px #666;
}
.css-slideshow figcaption {
position: absolute;
top: 5px;
color: #fff;
background: rgba(0,0,0, .3);
font-size: .8em;
padding: 8px 12px;
filter: alpha(opacity=0);
opacity: 0;
-webkit-transition: opacity .5s;
transition: opacity .5s;
}
.css-slideshow-attr {
max-width: 530px;
text-align: right;
font-size: .7em;
font-style: italic;
}
.css-slideshow-attr a {
color: #666;
}
.css-slideshow figure:nth-child(1) {
-webkit-animation: xfade 42s 39s infinite;
animation: xfade 42s 39s infinite;
}
.css-slideshow figure:nth-child(2) {
-webkit-animation: xfade 42s 27s infinite;
animation: xfade 42s 27s infinite;
}
.css-slideshow figure:nth-child(3) {
-webkit-animation: xfade 42s 15s infinite;
animation: xfade 42s 15s infinite;
}
.css-slideshow figure:nth-child(4) {
-webkit-animation: xfade 42s 3s infinite;
animation: xfade 42s 3s infinite;
}
.css-slideshow1 {
position: relative;
max-width: 100%;
height: auto;
}
.css-slideshow1 figure {
margin: 0;
width: 100%;
height: auto;
margin-left: 50%;
position: absolute;
}
.css-slideshow1 img {
-webkit-box-shadow: 0 0 2px #666;
box-shadow: 0 0 2px #666;
}
.css-slideshow1 figcaption {
position: absolute;
top: 5px;
color: #fff;
background: rgba(0,0,0, .3);
font-size: .8em;
padding: 8px 12px;
filter: alpha(opacity=0);
opacity: 0;
-webkit-transition: opacity .5s;
transition: opacity .5s;
}
.css-slideshow1-attr {
max-width: 530px;
text-align: right;
font-size: .7em;
font-style: italic;
}
.css-slideshow1-attr a {
color: #666;
}
.css-slideshow1 figure:nth-child(1) {
-webkit-animation: xfade 45s 42s infinite;
animation: xfade 45s 42s infinite;
}
.css-slideshow1 figure:nth-child(2) {
-webkit-animation: xfade 45s 30s infinite;
animation: xfade 45s 30s infinite;
}
.css-slideshow1 figure:nth-child(3) {
-webkit-animation: xfade 45s 18s infinite;
animation: xfade 45s 18s infinite;
}
.css-slideshow1 figure:nth-child(4) {
-webkit-animation: xfade 45s 6s infinite;
animation: xfade 45s 6s infinite;
}
.css-slideshow2 {
position: relative;
width: 100%;
height: auto;
}
.css-slideshow2 figure {
margin: 0;
width: 100%;
margin-top: 50%;
height: auto;
position: absolute;
}
.css-slideshow2 img {
-webkit-box-shadow: 0 0 2px #666;
box-shadow: 0 0 2px #666;
}
.css-slideshow2 figcaption {
position: absolute;
top: 5px;
color: #fff;
background: rgba(0,0,0, .3);
font-size: .8em;
padding: 8px 12px;
filter: alpha(opacity=0);
opacity: 0;
-webkit-transition: opacity .5s;
transition: opacity .5s;
}
.css-slideshow2-attr {
max-width: 530px;
text-align: right;
font-size: .7em;
font-style: italic;
}
.css-slideshow2-attr a {
color: #666;
}
.css-slideshow2 figure:nth-child(1) {
-webkit-animation: xfade 48s 45s infinite;
animation: xfade 48s 45s infinite;
}
.css-slideshow2 figure:nth-child(2) {
-webkit-animation: xfade 48s 33s infinite;
animation: xfade 48s 33s infinite;
}
.css-slideshow2 figure:nth-child(3) {
-webkit-animation: xfade 48s 21s infinite;
animation: xfade 48s 21s infinite;
}
.css-slideshow2 figure:nth-child(4) {
-webkit-animation: xfade 48s 9s infinite;
animation: xfade 48s 9s infinite;
}
.css-slideshow3 {
position: relative;
max-width: 100%;
height: auto;
}
.css-slideshow3 figure {
margin: 0;
width: 100%;
margin-left: 50%;
margin-top: 50%;
height: auto;
margin-left: 50%;
position: absolute;
}
.css-slideshow3 img {
-webkit-box-shadow: 0 0 2px #666;
box-shadow: 0 0 2px #666;
}
.css-slideshow3 figcaption {
position: absolute;
top: 5px;
color: #fff;
background: rgba(0,0,0, .3);
font-size: .8em;
padding: 8px 12px;
filter: alpha(opacity=0);
opacity: 0;
-webkit-transition: opacity .5s;
transition: opacity .5s;
}
.css-slideshow3-attr {
max-width: 530px;
text-align: right;
font-size: .7em;
font-style: italic;
}
.css-slideshow3-attr a {
color: #666;
}
.css-slideshow3 figure:nth-child(1) {
-webkit-animation: xfade 51s 48s infinite;
animation: xfade 51s 48s infinite;
}
.css-slideshow3 figure:nth-child(2) {
-webkit-animation: xfade 51s 36s infinite;
animation: xfade 51s 36s infinite;
}
.css-slideshow3 figure:nth-child(3) {
-webkit-animation: xfade 51s 24s infinite;
animation: xfade 51s 24s infinite;
}
.css-slideshow3 figure:nth-child(4) {
-webkit-animation: xfade 51s 12s infinite;
animation: xfade 51s 12s infinite;
}
#-webkit-keyframes "xfade" {
0% {
filter: alpha(opacity=100);
opacity: 1;
}
14.67% {
filter: alpha(opacity=100);
opacity: 1;
}
16.67% {
filter: alpha(opacity=0);
opacity: 0;
}
98% {
filter: alpha(opacity=0);
opacity: 0;
}
100% {
filter: alpha(opacity=100);
opacity: 1;
}
}
.image-slideshow{
padding-top: 3.5%;
padding-left: 5.5%;
}
Can somebody elaborate on what I need to add or remove or edit in order for this to work as it should. Thank you
i am working on a Infinite Scrolling banner for a page but i am having issues with its output.
my html code is this: `e
<div class="header">
<img class="first" src="image-1.jpg" alt="" />
<img src="image2.jpg" alt="" />
<img src="image3.jpg" alt="" />
<img src="image4.jpg" alt="" />
<img src="image5.jpg" alt="" />
<img src="image6.jpg" alt="" />
<img src="image1.jpg" alt="" />
<img src="image2.jpg" alt="" />
<img src="image3.jpg" alt="" />
<img src="image4.jpg" alt="" />
</div>
</div>
and my CSS code is this:
`* {margin: 0; padding: 0;}
body {
background: url('background.jpg');
}
#container {
width: 1000px;
overflow: hidden;
margin: 50px auto;
background: white;
}
/*header*/
header {
width: 800px;
margin: 40px auto;
}
header h1 {
text-align: center;
font: 100 60px/1.5 Helvetica, Verdana, sans-serif;
}
header p {
font: 100 15px/1.5 Helvetica, Verdana, sans-serif;
text-align: justify;
}
/*photobanner*/
.photobanner {
height: 233px;
width: 3550px;
margin-bottom: 80px;
}
/*keyframe animations*/
.first {
-webkit-animation: bannermove 30s linear infinite;
-moz-animation: bannermove 30s linear infinite;
-ms-animation: bannermove 30s linear infinite;
-o-animation: bannermove 30s linear infinite;
animation: bannermove 30s linear infinite;
}
#keyframes "bannermove" {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
#-moz-keyframes bannermove {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
#-webkit-keyframes "bannermove" {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
#-ms-keyframes "bannermove" {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
#-o-keyframes "bannermove" {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
when i run the html file i see the banner scrolling but i can see the other pictures as well that is not in the banner at the time..
i should be only getting 3 pictures moving at one time and all other pics hidden but they are showing as well..please help..
<!DOCTYPE html>
<html>
<head>
<title>Photo banner</title>
<style>
* {margin: 0; padding: 0;}
body {
background-color: #FF0000;
}
#container {
width: 1000px;
overflow: hidden;
margin: 50px auto;
background: white;
}
/*header*/
header {
width: 800px;
margin: 40px auto;
}
header h1 {
text-align: center;
font: 100 60px/1.5 Helvetica, Verdana, sans-serif;
}
header p {
font: 100 15px/1.5 Helvetica, Verdana, sans-serif;
text-align: justify;
}
/*photobanner*/
.photobanner {
height: 233px;
width: 3550px;
margin-bottom: 80px;
}
/*keyframe animations*/
.first {
-webkit-animation: bannermove 30s linear infinite;
-moz-animation: bannermove 30s linear infinite;
-ms-animation: bannermove 30s linear infinite;
-o-animation: bannermove 30s linear infinite;
animation: bannermove 30s linear infinite;
}
#keyframes "bannermove" {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
#-moz-keyframes bannermove {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
#-webkit-keyframes "bannermove" {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
#-ms-keyframes "bannermove" {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
#-o-keyframes "bannermove" {
0% {
margin-left: 0px;
}
100% {
margin-left: -2125px;
}
}
.photobanner {
height: 233px;
width: 3550px;
margin-bottom: 80px;
}
.photobanner img {
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.photobanner img:hover {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-o-transform: scale(1.1);
-ms-transform: scale(1.1);
transform: scale(1.1);
cursor: pointer;
-webkit-box-shadow: 0px 3px 5px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 3px 5px rgba(0,0,0,0.2);
box-shadow: 0px 3px 5px rgba(0,0,0,0.2);
}
</style>
</head>
<body>
<div id="container">
<header>
<h1>Animated Photo Banner</h1>
<p>Lorem ipsum dolor...</p>
</header>
<!-- Each image is 350px by 233px -->
<div class="photobanner">
<img class="first" src="http://designshack.net/tutorialexamples/photobanner/image-1.jpg" alt="">
<img src="http://designshack.net/tutorialexamples/photobanner/image-2.jpg" alt="">
<img src="http://designshack.net/tutorialexamples/photobanner/image-3.jpg" alt="">
<img src="http://designshack.net/tutorialexamples/photobanner/image-4.jpg" alt="">
<img src="http://designshack.net/tutorialexamples/photobanner/image-5.jpg" alt="">
<img src="http://designshack.net/tutorialexamples/photobanner/image-6.jpg" alt="">
<img src="http://designshack.net/tutorialexamples/photobanner/image-1.jpg" alt="">
<img src="http://designshack.net/tutorialexamples/photobanner/image-2.jpg" alt="">
<img src="http://designshack.net/tutorialexamples/photobanner/image-3.jpg" alt="">
<img src="http://designshack.net/tutorialexamples/photobanner/image-4.jpg" alt="">
</div>
</div>
</body>
</div>
So I'm getting acquainted with css3 and I've been trying to find a purely css slider. I finally found one that is exactly as I was looking for on code pen but for some reason when I try the code in localhost or jsfiddle it doesn't work. There is no external files that its accessing as far as I can tell in codepen and there is no jQuery needed. Below I've linked the (working) codepen and jsfiddle. Any ideas why it wont work elsewhere?
codepen
jsFiddle
html
<div class="slider">
<img class='photo' src="http://i.imgur.com/zMGSiyl.jpg" alt="" />
<img class='photo' src="http://i.imgur.com/soQhb13.jpg" alt="" />
<img class='photo' src="http://i.imgur.com/39yOaYB.jpg" alt="" />
<img class='photo' src="http://i.imgur.com/tnctKD4.jpg" alt="" />
</div>
css
body{background:#000;}
.slider{
margin:50px auto;
width:100%;
height:300px;
overflow:hidden;
position:relative;
}
.photo{
position:absolute;
animation:round 16s infinite;
opacity:0;
width:100%;
}
#keyframes round{
25%{opacity:1;}
40%{opacity:0;}
}
img:nth-child(4){animation-delay:0s;}
img:nth-child(3){animation-delay:4s;}
img:nth-child(2){animation-delay:8s;}
img:nth-child(1){animation-delay:12s;}
You may need to use vendor specific keyframes. Codepen is clever and is overcompensating in this instance.
#-webkit-keyframes NAME-YOUR-ANIMATION {
0% { opacity: 0; }
100% { opacity: 1; }
}
#-moz-keyframes NAME-YOUR-ANIMATION {
0% { opacity: 0; }
100% { opacity: 1; }
}
#-o-keyframes NAME-YOUR-ANIMATION {
0% { opacity: 0; }
100% { opacity: 1; }
}
#keyframes NAME-YOUR-ANIMATION {
0% { opacity: 0; }
100% { opacity: 1; }
}
More info http://css-tricks.com/snippets/css/keyframe-animation-syntax/
This works perfectly, please check: jsFiddle Demo. The syntax for the CSS3 animations and the keyframes which was being used in the code was the standard syntax, for e.g. animation:round 16s infinite;, #keyframes round{ 25%{opacity:1;} 40%{opacity:0;} } and img:nth-child(4){animation-delay:0s;}.
You should instead use -webkit-animation:round 16s infinite;`, `#-webkit-keyframes round{ 25%{opacity:1;} 40%{opacity:0;} } ` and `img:nth-child(4){-webkit-animation-delay:0s;} so that it's browser compatible.
More information on this is available over here.
body {
background: #000;
}
.slider {
margin: 50px auto;
width: 100%;
height: 300px;
overflow: hidden;
position: relative;
}
.photo {
position: absolute;
-webkit-animation: round 16s infinite;
-moz-animation: round 16s infinite;
-o-animation: round 16s infinite;
animation: round 16s infinite;
opacity: 0;
width: 100%;
}
#-webkit-keyframes round {
25% {
opacity: 1;
}
40% {
opacity: 0;
}
}
#-moz-keyframes round {
25% {
opacity: 1;
}
40% {
opacity: 0;
}
}
#-o-keyframes round {
25% {
opacity: 1;
}
40% {
opacity: 0;
}
}
#keyframes round {
25% {
opacity: 1;
}
40% {
opacity: 0;
}
}
img:nth-child(4) {
-webkit-animation-delay: 0s;
}
img:nth-child(3) {
-webkit-animation-delay: 4s;
}
img:nth-child(2) {
-webkit-animation-delay: 8s;
}
img:nth-child(1) {
-webkit-animation-delay: 12s;
}
<div class="slider">
<img class='photo' src="http://i.imgur.com/zMGSiyl.jpg" alt="" />
<img class='photo' src="http://i.imgur.com/soQhb13.jpg" alt="" />
<img class='photo' src="http://i.imgur.com/39yOaYB.jpg" alt="" />
<img class='photo' src="http://i.imgur.com/tnctKD4.jpg" alt="" />
</div>
I followed a tutorial for a CSS slideshow. It worked perfectly on the demo on codepen, but it doesn't seem to work when I try it on the website. Could it be that the site is not live yet? Or is that really stupid?
<div class="css-slideshow grid_6">
<figure>
<img src="http://v3.img.bostitch.eu/products/tools/ms-3219-e.jpg" alt="class-header-css3" width="250" height="250" class="alignnone size-full wp-image-172" />
</figure>
<figure>
<img src="http://v3.img.bostitch.eu/products/gallery/ms-series-%28app1%29.jpg" alt="class-header-semantics" width="250" height="250" class="alignnone size-full wp-image-179" />
</figure>
</div>
.css-slideshow{position: relative;
max-width: 250px;
height: 250px;
}
.css-slideshow figure{
margin: 0;
max-width: 250px;
height: 250px;
background: #000;
position: absolute;
}
.css-slideshow img{
box-shadow: 0 0 2px #666;
}
.css-slideshow:hover figure figcaption{
transition: opacity .5s;
opacity: 1;
}
.css-slideshow-attr{
max-width: 495px;
text-align: right;
font-size: .7em;
font-style: italic;
margin:0 auto;
}
.css-slideshow-attr a{
color: #666;
}
.css-slideshow figure{
opacity:0;
}
figure:nth-child(1) {
animation: xfade 12s 6s infinite;
}
figure:nth-child(2) {
animation: xfade 6s 0s infinite;
}
It won't be because the site isn't live, but for starts you haven't defined xfade, it'll be something like:
#keyframes xfade{
20% {
opacity:1;
}
50% {
opacity:0.5;
}
70% {
opacity:0;
}
}
depending on what you want, best way though to get help on here is to create a jsfiddle: http://jsfiddle.net/