The content on this website, including videos and code examples, is for educational purposes only. All demonstrations and designs are fictional and created to illustrate coding techniques. Any resemblance to existing websites or brands is purely coincidental.
The creators and administrators of this website do not claim ownership or affiliation with any existing websites or companies. Users are encouraged to use the information responsibly for learning purposes. Liability for any misuse of the content provided is not accepted.
Below is the html code for this video.
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Horizontal Image Carousel #7</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="carousel">
<div class="slide">
<div>
<img src="https://images.unsplash.com/photo-1611162617474-5b21e879e113?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1374&q=80"
alt="img 1" class="carousel-img">
</div>
<div class="slide-title-container">
<div class="slide-title-text">
Title for Image 1
</div>
</div>
</div>
<div class="slide">
<div>
<img src="https://images.unsplash.com/photo-1586899028174-e7098604235b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1471&q=80"
alt="img 2" class="carousel-img">
</div>
<div class="slide-title-container">
<div class="slide-title-text">
Title for Image 2
</div>
</div>
</div>
<div class="slide">
<div>
<img src="https://images.unsplash.com/photo-1643208589889-0735ad7218f0?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1469&q=80"
alt="img 3" class="carousel-img">
</div>
<div class="slide-title-container">
<div class="slide-title-text">
Title for Image 3
</div>
</div>
</div>
<div class="slide">
<div>
<img src="https://images.unsplash.com/photo-1521967906867-14ec9d64bee8?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt="img 4" class="carousel-img">
</div>
<div class="slide-title-container">
<div class="slide-title-text">
Title for Image 4
</div>
</div>
</div>
<div class="slide">
<div>
<img src="https://images.unsplash.com/photo-1615986201152-7686a4867f30?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1325&q=80"
alt="img 5" class="carousel-img">
</div>
<div class="slide-title-container">
<div class="slide-title-text">
Title for Image 5
</div>
</div>
</div>
<div class="slide">
<div>
<img src="https://images.unsplash.com/photo-1613280194169-6bb2f32a6bfa?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1471&q=80"
alt="img 6" class="carousel-img">
</div>
<div class="slide-title-container">
<div class="slide-title-text">
Title for Image 6
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Below is the css code for this video.
style.css
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
display: flex;
flex-direction: row;
height: 100vh;
width: 100%;
background: #0d0d0d;
color: #fafafa;
align-items: center;
justify-content: center;
padding: 0 100px;
margin: 0;
font-family: sans-serif;
}
.container {
width: 75%;
overflow: scroll;
}
.carousel {
font-size: 0;
margin: 70.3125px 0;
padding-bottom: 10px;
white-space: nowrap;
transition: 450ms transform;
}
.carousel:hover {
transform: translate3d(-62.5px, 0, 0);
}
.carousel:hover .slide {
opacity: 0.3;
}
.carousel:hover .slide:hover {
opacity: 1;
transform: scale(1.5);
}
.slide {
position: relative;
display: inline-block;
width: 250px;
height: 140.625px;
margin-right: 10px;
font-size: 20px;
cursor: pointer;
transform-origin: center left;
transition: 450ms all;
}
.slide:hover .slide-title-container {
opacity: 1;
}
.slide:hover~.slide {
transform: translate3d(125px, 0, 0);
}
.carousel-img {
height: 140.625px;
width: 250px;
object-fit: cover;
}
.slide-title-container {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
font-size: 10px;
background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
transition: 450ms opacity;
opacity: 0;
}
.slide-title-container::after, .slide-title-container::before {
content: "";
position: absolute;
top: 50%;
left: 50%;
display: #000;
}
.slide-title-container::after {
width: 50px;
height: 50px;
background: rgba(0, 0, 0, 0.5);
margin-top: -25px;
margin-left: -25px;
border: 3px solid #fafafa;
border-radius: 100%;
line-height: 50px;
text-align: center;
z-index: 1;
}
.slide-title-container::before {
content: "\25BA";
width: 100%;
left: 0;
font-size: 30px;
margin-left: 7px;
margin-top: -15px;
text-align: center;
z-index: 2;
}
.slide-title-text {
position: absolute;
bottom: 0;
padding: 10px;
}
Thanks for visiting