🚨 This uses experimental CSS which isn't supported by your browser yet 🚨

CSS Carousel Spec - Photo Gallery

Entry for CodePenChallenge April #3, 2025 - Card Carousel

About

Recently I was looking at the CSS Carousel Gallery site by Adam Argyle, and figured now would be as good a time as any to give this new CSS feature a spin.

I figured you can't go wrong with a photo gallery right? The primary thing I wanted to build out was a two-way carousel, a carousel-within-a-carousel... Per-country collections make up the horizontal-carousel, and a vertical-carousel for photos within that set. Say carousel one more time 🙃.

Another thing I got to experiment with was position-anchor and position-area, which allows us to link and position an element separate to it's parent container. This was very cool!

Any Problems?

I ran into a bit of a wall when it came to dropping the opacity for the next card.

I wanted the image to have around .2 opacity, while fully hiding the location title and description. I ended up in a rats nest of selectors trying to target it, to then only break the vertical-carousel in some way 😅.

I also ended up breaking the natural fall-back for browsers that don't support these features yet, well, kinda. The scrolling still works - but the text ends up in all the wrong places. With a bit of extra work I could probably improve the non-supporting browsers, but for now I'm just sticking up a warning banner.

While I think there are a lot of cool things to be achieved with CSS Carousels... This probably isn't one of them. While fun to do and to push the limits a bit, I wouldn't recommend implementing something like this for a photo gallery. Its overly clunky, and it's not a particularly good way to view the images either.

I'm happy I got to test it though.