In the code below, I have stacked five, vertically scrollable, images. I would like to replace each of these images with a slideshow carousel. In other words, I would like five stacked, horizontally scrollable slideshows, using just HTML and CSS (No JavaScript).
Does anyone know how that can be done?
Thanks!!
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>All about Nothing</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div>
<section class="blur-container SlideShow-1">
</section>
<section class="blur-container SlideShow-2">
</section>
<section class="blur-container SlideShow-3">
</section>
<section class="blur-container SlideShow-4">
</section>
<section class="blur-container SlideShow-5">
</section>
</div>
</body>
</html>
CSS Code:
section {
height: 100vh;
display: flex;
position: relative;
}
.blur-container {
background-size: cover !important;
background-position: center !important;
background-attachment: fixed !important;
&::before,
&::after {
top: 0px;
left: 0px;
content: '';
width: 100%;
height: 100%;
display: block;
position: absolute;
}
}
.SlideShow-1 {
background: url('https://arthur.io/img/art/jpg/000017344d60348e7/monika-bielskyte/untitled-27/large-2x/monika-bielskyte--untitled-27.webp');
}
.SlideShow-2 {
background: url('https://arthur.io/img/art/jpg/000017344d60398be/monika-bielskyte/untitled-29/large-2x/monika-bielskyte--untitled-29.webp');
}
.SlideShow-3 {
background: url('https://arthur.io/img/art/jpg/0017344d60a261291/monika-bielskyte/untitled-63/large-2x/monika-bielskyte--untitled-63.webp');
}
.SlideShow-4 {
background: url('https://arthur.io/img/art/jpg/00017344d603531b3/monika-bielskyte/untitled-19/large-2x/monika-bielskyte--untitled-19.webp');
}
.SlideShow-5 {
background: url('https://arthur.io/img/art/jpg/000017344d60398be/monika-bielskyte/untitled-29/large-2x/monika-bielskyte--untitled-29.webp');
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Heya,
Creating stacked, horizontally scrollable slideshows using only HTML and CSS (without JavaScript) involves a bit of creativity in your CSS design. While JavaScript is typically used for interactive components like slideshows, it’s possible to create a basic version with CSS only.
Here is an example:
HTML Structure: You will need to modify your HTML to include multiple images (or
div
elements representing slides) inside each slideshow section.CSS Styling: Use CSS to style these slideshows to be horizontally scrollable. This involves setting a container to display its contents in a row and allow for overflow in the horizontal direction.
HTML:
CSS:
In this setup, each
section
represents a slideshow, and thediv
elements inside are individual slides. Theoverflow-x: auto
CSS property on thesection
allows horizontal scrolling. Each slide is set to not grow or shrink and maintain its width, ensuring they line up horizontally.You can add as many slides as you want within each section, and you can style them with different background images or content as needed. Remember that this is a basic setup and won’t provide advanced features like automatic sliding or navigation buttons, which typically require JavaScript.