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 #8</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<ul class="carousel">
<li>
<input type="radio" name="slide" id="slide1" checked>
<label for="slide1"></label>
<img src="https://images.unsplash.com/photo-1539146789170-c49ca355f9f0?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1587&q=80"
alt="image 1">
</li>
<li>
<input type="radio" name="slide" id="slide2">
<label for="slide2"></label>
<img src="https://images.unsplash.com/photo-1578301996581-bf7caec556c0?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1351&q=80"
alt="image 2">
</li>
<li>
<input type="radio" name="slide" id="slide3">
<label for="slide3"></label>
<img src="https://images.unsplash.com/photo-1584278773680-8d940a213dcf?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1480&q=80"
alt="image 3">
</li>
<li>
<input type="radio" name="slide" id="slide4">
<label for="slide4"></label>
<img src="https://images.unsplash.com/photo-1515052945961-bbb80118b74b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1473&q=80"
alt="image 4">
</li>
</ul>
</body>
</html>
Below is the css code for this video.
style.css
* {
margin: 0;
padding: 0;
}
body {
height: 100vh;
width: 100%;
background-color: #aff1da;
background-image: radial-gradient(circle, rgba(255, 255, 255, 0.25), rgba(0, 0, 0, 0.75)), linear-gradient(left, transparent 50%,
rgba(0, 0, 0, 0.25) 50%);
background-position: 50% 75%, 50% 50%;
background-repeat: no-repeat, repeat;
background-size: 150% 150%, 48px 48px;
}
.carousel {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
height: 450px;
width: 600px;
background-color: #e6e6fa;
box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.25), 0 3px 1px rgba(255, 255, 255, 0.75), 0 -1px 1px 2px rgba(0, 0, 0, 0.25);
}
.carousel::before {
content: "";
position: absolute;
top: -40px;
left: -40px;
bottom: -40px;
right: -40px;
background-color: #b38b6d;
box-shadow: inset 0 1px 1px 1px rgba(255, 255, 255, 0.25), inset 0 -2px 1px rgba(0, 0, 0, 0.5), 0 5px 50px rgba(0, 0, 0, 0.25),
0 20px 20px -15px rgba(0, 0, 0, 0.25), 0 30px 20px -15px rgba(0, 0, 0, 0.25), 0 40px 20px -15px rgba(0, 0, 0, 0.25);
z-index: -1;
}
.carousel::after {
content: "";
position: absolute;
top: -20px;
left: -20px;
bottom: -20px;
right: -20px;
background-color: #faf0e6;
box-shadow: 0 2px 1px rgba(255, 255, 255, 0.25), 0 -1px 1px 1px rgba(0, 0, 0, 0.5), inset 0 2px 3px 1px rgba(0, 0, 0, 0.25),
inset 0 4px 3px 1px rgba(0, 0, 0, 0.25), inset 0 6px 3px 1px rgba(0, 0, 0, 0.25);
z-index: -1;
}
.carousel li {
position: absolute;
list-style: none;
box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}
.carousel input {
display: none;
}
.carousel label {
position: absolute;
left: 582px;
bottom: 8px;
display: block;
height: 8px;
width: 8px;
background-color: #111;
background-image: linear-gradient(transparent, rgba(0, 0, 0, 0.25));
border: 3px solid transparent;
border-radius: 100%;
cursor: pointer;
z-index: 10;
transition: 0.25s;
opacity: 0;
visibility: hidden;
}
.carousel label::after {
content: "";
position: absolute;
top: -3px;
left: -3px;
bottom: -3px;
right: -3px;
border-radius: 100%;
box-shadow: inset 0 0 0 3px #111, inset 0 2px 2px #000, 0 1px 1px rgba(0, 0, 0, 0.25);
}
.carousel:hover label {
opacity: 1;
visibility: visible;
}
.carousel input:checked+label {
background-color: #fffafa;
}
.carousel:hover li:nth-child(1) label {
left: 18px;
}
.carousel:hover li:nth-child(2) label {
left: 36px;
}
.carousel:hover li:nth-child(3) label {
left: 54px;
}
.carousel:hover li:nth-child(4) label {
left: 72px;
}
.carousel img {
height: 450px;
width: 600px;
vertical-align: top;
transition: 0.25s;
opacity: 0;
visibility: hidden;
}
.carousel li input:checked~img {
opacity: 1;
visibility: visible;
z-index: 10;
}
Thanks for visiting