HTMLify

Views: 22 | Author: djdj
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Image Slider</title>
    <link rel="stylesheet" href="style.css">
    <style>
        body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #f0f0f0;
}

.slider {
    width: 80%;
    overflow: hidden;
}

.slide-track {
    display: flex;
    width: calc(100% * 6); /* Adjust according to the number of images */
    animation: scroll 15s linear infinite;
}

.slide {
    width: calc(100% / 6); /* Adjust according to the number of images */
    display: flex;
    justify-content: center;
    align-items: center;
}

.slide img {
    width: 100%;
    height: auto;
    border-radius: 10px;
}

@keyframes scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%); /* Adjust according to the number of images */
    }
}

    </style>

</head>
<body>
    <div class="slider">
        <div class="slide-track">
            <div class="slide"><img src="1.jpg" alt="Image 1"></div>
            <div class="slide"><img src="2.jpg" alt="Image 2"></div>
            <div class="slide"><img src="3.jpg" alt="Image 3"></div>
            <!-- Duplicate images for smooth loop -->
            <div class="slide"><img src="1.jpg" alt="Image 1"></div>
            <div class="slide"><img src="2.jpg" alt="Image 2"></div>
            <div class="slide"><img src="3.jpg" alt="Image 3"></div>
        </div>
    </div>
</body>
</html>

Comments