In this article, I'll demonstrate how to add a carousel slider to your websites using just a few lines of CSS code.
Carousel was a type of content used on websites before it became popular on social media. Especially popular and effective on Instagram, carousel is the term used for posts that include multiple photos.
If you need a powerful yet simple slider with CSS nowadays, you can meet that need by writing just a few lines of CSS code. Take a look at this minimalist example.
ul {
display: flex;
list-style: none;
overflow: auto;
scroll-snap-type: x mandatory;
}
li {
flex-shrink: 0;
width: 100%;
scroll-snap-align: start;
}
I wanted to explain how to create a simple carousel for your websites in this article. If you need a more advanced carousel in your projects, you will need to use JavaScript.