The Image Slider is also called Image Carousel or Slideshow. The Image Slider may be the convenient way to display the changing or sliding images one by one on your website. Image slider or slideshow commonly shows one large image at a time with a little scrap of text, at the bottom of the image. In the Image Slider, the images will slide one by one when the button is clicked, manually.
In this blog Image Slider, there are four images but only a single image will appear at the front. There are buttons on the bottom of the image which works manually by clicking on the button. These buttons slide the images forward and backward one by one on a button click. By clicking on the button you can see the images as you want.
The source code of this Simple Image Slider is given below, if you want the source code of this program, you can copy it. You can use this Simple Image Slider with your creativity and can take this project to the next level.
Simple Image Slider [Source Code]
To make this website, you would like to make two files: an HTML file & a CSS file. First, create an HTML file with the name of index.html and remember, you have to create a file with a .html extension.
body{
background: #9D50BB;
background: -webkit-linear-gradient(to right, #6E48AA, #9D50BB);
background: linear-gradient(to right, #6E48AA, #9D50BB);
}
#slider-wrapper {
width: 940px;
height: 470px;
margin: 100px auto;
position: relative;
margin-bottom: 0px;
background: rgba(0, 0, 0, 0.5);
overflow: hidden;
border-radius: 10px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
#s1 {
padding: 6px;
background: #fff;
position: absolute;
left: 50%;
bottom: 25px;
margin-left: -36px;
border-radius: 20px;
opacity: 0.3;
cursor: pointer;
z-index: 999;
}
#s2 {
padding: 6px;
background: #fff;
position: absolute;
left: 50%;
bottom: 25px;
margin-left: -12px;
border-radius: 20px;
opacity: 0.3;
cursor: pointer;
z-index: 999;
}
#s3 {
padding: 6px;
background: #fff;
position: absolute;
left: 50%;
bottom: 25px;
margin-left: 12px;
border-radius: 20px;
opacity: 0.3;
cursor: pointer;
z-index: 999;
}
#s4 {
padding: 6px;
background: #fff;
position: absolute;
left: 50%;
bottom: 25px;
margin-left: 36px;
border-radius: 20px;
opacity: 0.3;
cursor: pointer;
z-index: 999;
}
#s1:hover,
#s2:hover,
#s3:hover,
#s4:hover {
opacity: 1;
}
.inner-wrapper {
width: 940px;
height: 470px;
position: absolute;
top: 0;
left: 0;
margin-bottom: 0px;
overflow: hidden;
}
.control {
display: none;
}
#Slide1:checked ~ .overflow-wrapper {
margin-left: 0%;
}
#Slide2:checked ~ .overflow-wrapper {
margin-left: -100%;
}
#Slide3:checked ~ .overflow-wrapper {
margin-left: -200%;
}
#Slide4:checked ~ .overflow-wrapper {
margin-left: -300%;
}
#Slide1:checked + #s1 {
opacity: 1;
}
#Slide2:checked + #s2 {
opacity: 1;
}
#Slide3:checked + #s3 {
opacity: 1;
}
#Slide4:checked + #s4 {
opacity: 1;
}
.overflow-wrapper {
width: 400%;
height: 100%;
position: absolute;
top: 0;
left: 0;
overflow-y: hidden;
z-index: 1;
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
.slide img {
width: 25%;
float: left;
}
.credit a{
text-decoration: none;
color: #fff;
font-weight: 800;
}
.credit {
font-family: Verdana, Geneva, Tahoma, sans-serif;
margin: 10px;
color:#000;
text-align: center;
}
Thank you for reading our blog. If you face any problem in creating this Simple Image Slider using HTML & CSS, then contact us or comment us. We’ll try to provide a solution to your problem as soon as possible.
Post a Comment
Thank you
Learning robo team