Are you ready to learn how to create an image slider using only CSS? Look no
further! In this tutorial, we'll walk you through the step-by-step process of
building a sleek and modern image slider using HTML and CSS. No JavaScript
required! In this tutorial We'll cover setting up the HTML structure for the
slider.
This will include creating the container element and styling the slider with
CSS. You'll also learn how to add transitions and animations to create a
smooth sliding effect. By the end of this tutorial, you'll have a fully
functional image slider that you can use on your own website. Whether you're a
beginner or an experienced developer, this tutorial has something for you. So
let's get started creating your own image slider using CSS today!
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="css/style.css">
<link href="https://fonts.googleapis.com/css?family=Karla" rel="stylesheet">
<title>slide image tutorial</title>
</head>
<body>
<h1>Auto - Image Slider HTML and CSS</h1>
<div class="slider-frame">
<div class="slide-images">
<div class="img-container">
<img src="image/image 1.jpg">
</div>
<div class="img-container">
<img src="image/image 2.jpg">
</div>
<div class="img-container">
<img src="image/image 3.jpg">
</div>
</div>
</div>
</body>
</html>
body{
padding: 0;
margin: 0;
background-color: floralwhite;
}
h1{
margin-top: 50px;
margin-left: 510px;
font-size: 60px;
font-family: 'Karla', sans-serif;
font-weight: lighter;
}
.slider-frame{
overflow: hidden;
height: 800px;
width: 1200px;
margin-left: 360px;
margin-top: 20px;
}
/*---------- SLIDE ANIMATION --------------*/
@keyframes slide_animation{
0% {left:0px;}
10% {left:0px;}
20% {left:1200px;}
30% {left:1200px;}
40% {left: 2400px;}
50% {left: 2400px;}
60% {left: 1200px;}
70% {left: 1200px;}
80% {left: 0px;}
90% {left: 0px;}
100% {left:0px;}
}
@-webkit-keyframes slide_animation{
0% {left:0px;}
10% {left:0px;}
20% {left:1200px;}
30% {left:1200px;}
40% {left: 2400px;}
50% {left: 2400px;}
60% {left: 1200px;}
70% {left: 1200px;}
80% {left: 0px;}
90% {left: 0px;}
100% {left:0px;}
}
.slide-images{
width: 3600px;
height: 800px;
margin: 0 0 0 -2400px;
position: relative;
-webkit-animation-name: slide_animation;
animation-name: slide_animation;
-webkit-animation-duration: 33s;
animation-duration: 33s;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
-webkit-animation-direction: alternate;
animation-direction: alternate;
-webkit-animation-play-state: running;
animation-play-state: running;
}
.img-container{
height: 800px;
width: 1200px;
position: relative;
float: left;
}
Watch the full tutorial video here:
Comments
Post a Comment