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 #03</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="carousel">
<input type="radio" name="slides" id="slide1" checked>
<input type="radio" name="slides" id="slide2">
<input type="radio" name="slides" id="slide3">
<ul class="cslides">
<li class="cslide">
<figure>
<div>
<img src="https://images.unsplash.com/photo-1422393462206-207b0fbd8d6b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt="cs img 1">
</div>
<figcaption>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Debitis consequatur reiciendis
similique, quo, deleniti labore mollitia dolore in id sint ad eius magni quisquam commodi,
quidem eaque voluptatum est voluptatem.
</figcaption>
</figure>
</li>
<li class="cslide">
<figure>
<div>
<img src="https://images.unsplash.com/photo-1505765050516-f72dcac9c60e?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt="cs img 2">
</div>
<figcaption>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Veritatis totam eligendi nesciunt
minima, aliquid eum cum, minus sint laboriosam obcaecati ipsum a quam corporis, recusandae
quae velit nam. Labore, dolorem.
</figcaption>
</figure>
</li>
<li class="cslide">
<figure>
<div>
<img src="https://images.unsplash.com/photo-1499557354967-2b2d8910bcca?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1472&q=80"
alt="cs img 3">
</div>
<figcaption>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Praesentium laudantium laboriosam
quas iure provident sunt mollitia, quos neque natus consectetur, cum aut ipsa itaque quo,
dolorem illum sapiente eveniet totam!
</figcaption>
</figure>
</li>
</ul>
<ul class="thumbnails">
<li>
<label for="slide1">
<img src="https://images.unsplash.com/photo-1422393462206-207b0fbd8d6b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt="thumbnail 1">
</label>
</li>
<li>
<label for="slide2">
<img src="https://images.unsplash.com/photo-1505765050516-f72dcac9c60e?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt="thumbnail 2">
</label>
</li>
<li>
<label for="slide3">
<img src="https://images.unsplash.com/photo-1499557354967-2b2d8910bcca?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1472&q=80"
alt="thumbnail 3">
</label>
</li>
</ul>
</div>
</div>
</body>
</html>
Below is the css code for this video.
style.css
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
height: 100vh;
width: 100%;
background-color: #000000;
background-image: linear-gradient(135deg, #76daffbf, #fcd000bf);
}
.container {
width: 54%;
margin: 0 auto;
padding: 25px 0 0;
}
.carousel {
display: block;
text-align: left;
position: relative;
}
.carousel input {
position: absolute;
height: 1px;
width: 1px;
margin: -1px;
padding: 0;
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
overflow: hidden;
}
.carousel input:nth-of-type(1):checked~.cslides .cslide:first-of-type {
margin-left: 0;
}
.carousel input:nth-of-type(2):checked~.cslides .cslide:first-of-type {
margin-left: -100%;
}
.carousel input:nth-of-type(3):checked~.cslides .cslide:first-of-type {
margin-left: -200%;
}
.carousel input:nth-of-type(1):checked~.thumbnails li:nth-of-type(1),
.carousel input:nth-of-type(2):checked~.thumbnails li:nth-of-type(2),
.carousel input:nth-of-type(3):checked~.thumbnails li:nth-of-type(3) {
box-shadow: 1px 1px 0 #777, 2px 2px 0 #888, 3px 3px 0 #777, 4px 4px 0 #888, 5px 5px #777;
opacity: 1;
}
.cslides {
position: relative;
padding: 0;
margin: 0;
overflow: hidden;
white-space: nowrap;
z-index: 1;
box-sizing: border-box;
display: flex;
}
.cslide {
position: relative;
width: 100%;
height: 100%;
display: block;
flex: 1 0 100%;
overflow: hidden;
box-sizing: border-box;
white-space: normal;
transition: all 0.25s ease-in-out;
}
.cslide figure {
display: flex;
margin: 0;
}
.cslide div {
position: relative;
width: 100%;
}
.cslide div::before {
content: "";
display: block;
width: 100%;
padding-top: 66.67%;
}
.cslide div img {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
height: 100%;
width: 100%;
}
.cslide img {
display: block;
flex: 1 1 auto;
object-fit: cover;
}
.cslide figcaption {
align-self: flex-end;
flex: 0 0 auto;
width: 25%;
padding: 0 0 0 20px;
text-align: justify;
color: #ffffff;
font-size: 17px;
}
.thumbnails {
list-style: none;
padding: 0;
margin: 0 -10px;
display: flex;
}
.cslides+.thumbnails {
margin-top: 20px;
}
.thumbnails li {
flex: 1 1 auto;
max-width: 33.33%;
margin: 0 10px;
transition: all 0.25s ease-in-out;
}
.thumbnails label {
display: block;
position: relative;
}
.thumbnails label::before {
display: block;
content: "";
padding-top: 100%;
width: 100%;
}
.thumbnails label img {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
height: 100%;
width: 100%;
}
.thumbnails img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
.thumbnails label:hover, .thumbnails label:focus {
cursor: pointer;
}
Thanks for visiting