Lecture
Creating Carousel Structure 2
Continuing from the previous lesson, we will further detail the structure of a carousel.
Slides
Carousel Slide HTML
<div class="slideshow-container"> <div class="my-slides fade"> <img src="https://images.pexels.com/photos/1099680/pexels-photo-1099680.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2" class="slide-image" /> <div class="slide-text">Image Description 1</div> </div> <div class="my-slides fade"> <img src="https://images.pexels.com/photos/958545/pexels-photo-958545.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2" class="slide-image" /> <div class="slide-text">Image Description 2</div> </div> <div class="my-slides fade"> <img src="https://images.pexels.com/photos/1640774/pexels-photo-1640774.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2" class="slide-image" /> <div class="slide-text">Image Description 3</div> </div> ... </div>
The outermost <div> element with the slideshow-container class acts as the container for the carousel content, which includes the "slides".
This container holds three slides, each composed of an image and a description.
Each slide is wrapped in a <div> with the class my-slides. The example code above is composed of three slides, but
Example Slide Composition
<div class="my-slides fade">Slide Content</div>
you can add more slides like the example above.
Each slide displays an image using the HTML <img> tag and applies styles to the slide image using the slide-image class. Additionally, a <div> element with the slide-text class is used to provide a description for the image.
Example Slide Composition
<div class="my-slides fade"> <img src="https://images.pexels.com/photos/1099680/pexels-photo-1099680.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2" class="slide-image" /> <div class="slide-text">Image Description 1</div> </div>
Lessons in this chapter Β· Creating a Carousel
- 1. What is a Carousel?
- 2. The Role of a Carousel
- 3. Carousel Components
- 4. Creating Carousel Structure 1
- 5. Creating Carousel Structure 2
- 6. Creating Carousel Structure 3
- 7. Styling the Carousel Container
- 8. Styling the Carousel with CSS
- 9. Slide Animation
- 10. Carousel Button Styling 1
- 11. Carousel Button Styling 2
- 12. Creating a Carousel Function 1
- 13. Creating a Carousel Feature 2
- 14. Creating Carousel Function 3
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help