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 #04</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="carousel">
<div class="slide">
<span>Text 1</span>
</div>
<div class="slide">
<span>Text 2</span>
</div>
<div class="slide">
<span>Text 3</span>
</div>
<div class="slide">
<span>Text 4</span>
</div>
<div class="slide">
<span>Text 5</span>
</div>
<div class="slide">
<span>Text 6</span>
</div>
<div class="slide">
<span>Text 7</span>
</div>
<div class="slide">
<span>Text 8</span>
</div>
<div class="slide">
<span>Text 9</span>
</div>
</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: #2234ae;
background-image: linear-gradient(to right, #2234ae, #191714);
font-family: 'Courier New', Courier, monospace;
color: #dadada;
text-shadow: 1px 1px #adadad;
}
.container {
position: relative;
width: 320px;
margin: 125px auto 0 auto;
perspective: 900px;
}
.carousel {
position: absolute;
width: 100%;
height: 100%;
transform-style: preserve-3d;
animation: rotatingImages 36s infinite forwards linear;
}
.slide {
position: absolute;
width: 320px;
height: 180px;
top: 20px;
left: 0;
right: 0;
background-size: cover;
box-shadow: inset 0 0 0 250px rgba(0, 0, 0, 0.33);
display: flex;
}
span {
margin: auto auto 0 2%;
font-size: 24px;
}
.slide:nth-child(1) {
background-image: url("https://images.unsplash.com/photo-1658165928995-d15d058bd42b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1528&q=80");
transform: rotateY(0deg) translateZ(450px);
}
.slide:nth-child(2) {
background-image: url("https://images.unsplash.com/photo-1658041331919-c6991a19e217?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80");
transform: rotateY(40deg) translateZ(450px);
}
.slide:nth-child(3) {
background-image: url("https://images.unsplash.com/uploads/14110635637836178f553/dcc2ccd9?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80");
transform: rotateY(80deg) translateZ(450px);
}
.slide:nth-child(4) {
background-image: url("https://images.unsplash.com/photo-1506261423908-ea2559c1f24c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1484&q=80");
transform: rotateY(120deg) translateZ(450px);
}
.slide:nth-child(5) {
background-image: url("https://images.unsplash.com/photo-1588315029754-2dd089d39a1a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1471&q=80");
transform: rotateY(160deg) translateZ(450px);
}
.slide:nth-child(6) {
background-image: url("https://images.unsplash.com/photo-1465990138262-b7c355d1ef90?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80");
transform: rotateY(200deg) translateZ(450px);
}
.slide:nth-child(7) {
background-image: url("https://images.unsplash.com/photo-1613832205745-01e26a06922a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80");
transform: rotateY(240deg) translateZ(450px);
}
.slide:nth-child(8) {
background-image: url("https://images.unsplash.com/photo-1512386923336-1440f4afe1d9?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80");
transform: rotateY(280deg) translateZ(450px);
}
.slide:nth-child(9) {
background-image: url("https://images.unsplash.com/photo-1595980542930-9eea66620834?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1074&q=80");
transform: rotateY(320deg) translateZ(450px);
}
@keyframes rotatingImages {
from {
transform: rotateY(0deg);
}
to {
transform: rotateY(-360deg);
}
}
Thanks for visiting