The Slider is also called Carousel or Slideshow. The Slider may be the convenient way to display the changing or sliding cards one by one on the website. In this Testimonial Card Slider, the cards slide one by one by clicking on the slider button.
In this blog (Testimonial Card Slider) on the webpage, there is a card with a profile icon at the top center and a there is a quote inside the card, and a slider controls at the bottom side. These sliders are used to slide the preview cards. There are three cards with a quote and when you click on the slider button each card slides smoothly and shows another card.
In this card, the CSS border-radius property is used to make the corner of the card to be curved. The onclick function on the slider button is made by using JavaScript.
The source code of this Testimonial Card Slider using HTML, CSS & JavaScript is given below, if you want the source code of this program, you can copy it. You can use this Testimonial Card Slider code on your projects.
Testimonial Card Slider using HTML, CSS & JavaScript [Source Code]
To make this website, you would like to make three files: an HTML file, a CSS file & a JavaScript file. First, create an HTML file with the name of index.html and remember, you have to create a file with a .html extension.
* {
padding: 0;
margin: 0;
font-family: sans-serif;
}
.container{
width: 100%;
height: 100vh;
background: #12192c;
position: relative;
}
.veiw-box{
width: 900px;
height: 500px;
border-radius: 220px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
#testimonials{
display: flex;
transition: 0.5s;
}
.user{
width: 800px;
text-align: center;
padding: 20px 70px;
box-sizing: border-box;
background: #12192c;
border-radius: 200px;
box-shadow: 0 10px 20px -5px #00000061;
position: relative;
border: 10px solid #cbb4f5;
}
.space{
margin: 0 70px;
}
.user img{
width: 120px;
border-radius: 50%;
border: 10px solid #202124;
position: absolute;
top: -80px;
left: 50%;
transform: translateX(-50%);
}
.user p{
font-size: 22px;
color: #cbb4f5;
line-height: 32px;
margin: 60px 0 30px;
}
.user p::before{
content: '\201C';
font-size: 120px;
height: 0;
display: inline-block;
vertical-align: -57;
margin-right: 10px;
}
.user p::after{
content: '\201D';
font-size: 120px;
height: 0;
display: inline-block;
vertical-align: -70;
margin-left: 10px;
}
.user h3{
font-size: 26px;
color: #cbb4f5;
}
.controls{
display: flex;
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
}
.controls span{
width: 15px;
height: 15px;
background: #cbb4f5;
border-radius: 15px;
margin: 0 5px;
cursor: pointer;
transition: 0.5s;
}
.active{
width: 45px !important;
}
.credit{
text-align: center;
color: #cbb4f5;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}
.credit a{
text-decoration: none;
color:#fff;
font-weight: bold;
}
var testimonials = document.getElementById('testimonials');
var control1 = document.getElementById('control1');
var control2 = document.getElementById('control2');
var control3 = document.getElementById('control3');
control1.onclick=function(){
testimonials.style.transform = "translateX(870px)";
control1.classList.add("active");
control2.classList.remove("active");
control3.classList.remove("active");
}
control2.onclick=function(){
testimonials.style.transform = "translateX(0px)";
control1.classList.remove("active");
control2.classList.add("active");
control3.classList.remove("active");
}
control3.onclick=function(){
testimonials.style.transform = "translateX(-870px)";
control1.classList.remove("active");
control2.classList.remove("active");
control3.classList.add("active");
}
Thank you for reading our blog. If you face any problem in creating this Testimonial Card Slider using HTML, CSS & JavaScript, 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