A responsive CSS-only lightbox: view demo.
Tested in: Chrome, Edge (OS X/Win), Firefox, Safari (desktop/mobile), Brave
- add Next and Previous buttons?
- animate opacity on close (hm. Fixes welcome!)
- simplify close box with
position: absolute - move figcaption to bottom and centre text
- make opacity default animation, leave drop-down as option
- make entire image click to close
- make gallery preview image height adjustable
- use CSS custom properties for some colors
- fix non-scrolling image height issue
- rewrite HTML and CSS to use
figureand usefigcaptiontags - set CSS variables for the crucial dimensions
- fix bug where part of the clickable preview is obscured at wider screen sizes
- center the preview image with
object-fitandobject-position - add breakpoint to separate larger from mobile sizes
Very extensively adapted from a good foundation: Create a pure css image lightbox