How To Create A Product Slider in HTML CSS And JS
Learn how to create a Product Slider using HTML, CSS, and JavaScript. This is a Super easy way to create a Product Slider using HTML, CSS, and JavaScript. This card Slider section is fully Responsive and has all browser compatibility.
I used HTML, CSS, and Swiper Js to create the this. If you follow this tutorial step by step, you will be able to make this beautiful Product Slider.
I have more than Four years experience in Frontend(HTML, CSS, and JS). I promise you, I will try to provide you best way to create Product Slider using HTML, CSS, and JavaScript
Create A Product Slider in HTML CSS And JS
Product Slider HTML
*{
margin: 0px;
padding: 0px;
font-family: poppins;
box-sizing: border-box;
}
a{
text-decoration: none;
}
ul{
list-style: none;
}
body{
background-color: #f8f8f8;
}
/*==Slider==========================*/
#p_slider{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
max-width: 1200px;
width: 90%;
min-height: 100vh;
margin: auto;
}
.product-box{
max-width:100%;
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
user-select: none;
}
.product-box-img{
width: 300px;
height:370px;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
background-color: #ffffff;
position: relative;
padding:20px;
}
.product-box-img img{
width:100%;
height:100%;
object-fit: contain;
object-position: center;
overflow: visible;
}
.product-box-img::before,
.product-box-img::after{
content: '';
position: absolute;
left: 50%;
top: 50%;
width: 370px;
height: 300px;
transform: translate(-50%,-50%);
top: 10%;
left: -10%;
border: 2px solid #e7e7e7;
border-radius: 50%;
z-index: -1;
transform: rotate(-50deg);
animation-name: rotate2;
animation-duration: 10s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
.product-box-img::after{
border: 2px solid #1295d1c0;
animation-name: rotate;
}
@keyframes rotate{
from{ transform: rotate(-360deg); }
to{ transform: rotate(360deg); }
}
@keyframes rotate2{
from{ transform: rotate(360deg); }
to{ transform: rotate(-360deg); }
}
.product-box-text{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
}
.product-box-text a{
color: #333333;
font-size: 1.2rem;
font-weight: 600;
margin-top: 20px;
letter-spacing: 2px;
text-transform: uppercase;
}
.product-box-text span{
color: #535353;
font-weight: 600;
}
.mySwiper{
width: 100%;
overflow: hidden;
}
.swiper-pagination{
position: static !important;
margin-top: 70px;
}
.swiper-pagination-progressbar-fill{
background: #2b2b2b !important;
}
.swiper-pagination-progressbar{
background: #e2e2e2 !important;
height: 3px !important;
border-radius: 4px !important;
}
@media(max-width:400px){
.product-box-img{
width: 80%;
height: 300px;}
.product-box-img::before,
.product-box-img::after{
width: 90%;
height: 300px;
top: 0%;
left: 5%;}
}
@media(max-width:330px){
.product-box-img{
width: 80%;
height: 250px;}
.product-box-img::before,
.product-box-img::after{
width: 90%;
height: 250px;
top: 0%;
left: 5%;}
}

Comments