Saturday, 25 October 2014

CSS3 Keyframes Slideshow

CSS3 Keyframes Slideshow

This is just example on what you can do with keyframes, its not tutorial, if You are not familiar with keyframes animation, CSS as language or HTML, click here : CSS3 Keyframes Full Tutorial  ||  CSS Full Tutorial  ||  HTML Full Tutorial

The below keyframe code is only for Chrome and Safari but you can add support for mozilla, opera and IE by copying the code and adding the -moz-, -ms- and -o- vendor prefixes.

Note:


All those strange letters are just links. Dont thing about them.


Example:


<html>

<head>
<title>CSS3 @keyframes slideshow</title>
<style>
.slideShow {

width: 400px;

height: 200px;
border: 1px solid #000;
background: url(https://lh4.googleusercontent.com/-Q2sMIBwrQ5I/VEwMT600M3I/AAAAAAAAALA/aULUEqw4I5w/w400-h200-p/crew.jpg);
background-repeat: no-repeat;
-webkit-animation: slideShow 15s 1s infinite alternate;
 -moz-animation: slideShow 15s 1s infinite alternate;
-ms-animation: slideShow 15s 1s infinite alternate; 
animation: slideShow 15s 1s infinite alternate;

}


// Chrome and Safari


@-webkit-keyframes slideShow {


0% {

background-image: url(https://lh4.googleusercontent.com/-Q2sMIBwrQ5I/VEwMT600M3I/AAAAAAAAALA/aULUEqw4I5w/w400-h200-p/crew.jpg) ;
    }

25% {

background-image: url(https://lh3.googleusercontent.com/-zsPWHNiPQpQ/VEwMT-CHM6I/AAAAAAAAALQ/9gG-CQpeTEg/w400-h200-p/elder.jpg) ;
}

50% {

background-image: url(https://lh4.googleusercontent.com/--5T76-YvQ4A/VEwMTygogVI/AAAAAAAAALY/6XScjpUKp3A/w400-h200-p/nfs.jpg) ;
}

75% {

background-image: url(https://lh6.googleusercontent.com/-RGp2qeEeIgk/VEwMUvHTHtI/AAAAAAAAALI/hfM8kNK-shs/w400-h200-p/poseidon.jpg) ;
}

100% {

background-image: url(https://lh4.googleusercontent.com/-nKOiqDa0Mzc/VEwMUxhcz1I/AAAAAAAAALM/XbTXARGfz8A/w400-h200-p/tanks.jpg);
}

}


</style>
</head>
<body>
<div class="slideShow"></div>
</body>
</html>


LIVE DEMO