I created a simple carousel design:
.index {
background-color: var(--color-blue);
}
.container {
display: flex;
overflow: auto;
outline: 10px solid black;
flex: none;
}
.container.x {
width: 100%;
flex-flow: row nowrap;
}
.x.mandatory-scroll-snapping {
scroll-snap-type: x mandatory;
}
.container > div {
text-align: center;
scroll-snap-align: center;
flex: none;
}
.carousel-card {
width: 100vw;
height: 30rem;
}
h1 {
color: blue;
}
h2 {
color: red;
}
h3 {
color: green;
}
h1, h2, h3 {
font-size: 10rem
}
<div class="index">
<div class="container x mandatory-scroll-snapping" dir="ltr">
<div class="carousel-card">
<h1>ONE<h1>
</div>
<div class="carousel-card">
<h2>TWO</h2>
</div>
<div class="carousel-card">
<h3>THREE</h3>
</div>
</div>
</div>
I want to maintain the horizontal scrolling for mobile devices, but I want to include dots and highlight the active one within a separate div.
I prefer not to use bootstrap, jquery, or any other library (otherwise I would have implemented it already).
I've been searching for a solution without success:
https://developer.mozilla.org/en-US/docs/Web/CSS/:target
Your assistance is greatly appreciated! :)