Expanding on the previous example, we will create scroll markers to enable direct navigation to different columns by applying a scroll-marker-group to the container and a ::scroll-marker to each ::column pseudo-element. The HTML remains unchanged.
CSS
We create a scroll marker group with the scroll-marker-group property, placing the group after all the content:
ul {
scroll-marker-group: after;
}
We then apply styles to the ::scroll-marker-group pseudo-element to lay out the scroll markers in the center of the row with a 0.4em gap between each one:
::scroll-marker-group {
display: flex;
gap: 0.4em;
place-content: center;
}
Finally, we use the ::scroll-marker pseudo-element to create a round, transparent marker for each list item with a black border, then style the marker of the currently-scrolled element differently from the others, targeting the marker with the :target-current pseudo-class:
ul::column::scroll-marker {
content: "";
width: 16px;
height: 16px;
background-color: transparent;
border: 2px solid black;
border-radius: 10px;
}
ul::column::scroll-marker:target-current {
background-color: black;
}
Result
Try pressing the scroll markers to jump straight to each page. Note how the current marker is highlighted so you can see where you are in the pagination. Also try tabbing to the scroll marker group, then use the cursor keys to cycle through each page.
See Creating CSS carousels for more carousel examples.