Build a responsive image gallery with category filtering and a lightbox viewer.
- 10 photo cards in a 3-column CSS Grid
- Filter buttons — All / Nature
- Hover effect — card lifts up, title label fades in
- Lightbox — click any card to open fullscreen view
- Prev / Next buttons + keyboard arrow key navigation
- Click backdrop or press Escape to close lightbox
- Responsive — 3 cols → 2 cols → 1 col on mobile
- Live photo count updates when filter changes
display: grid+grid-template-columns: repeat(3, 1fr)— equal 3-column grid@mediaqueries — changes columns on smaller screensopacity: 0→opacity: 1on hover — label fade intransform: translateY(-4px)on hover — card lift effectposition: fixed; inset: 0— lightbox covers full screenpointer-events: none/all— shows/hides lightbox without removing from DOMe.target === this— close when clicking the backdrop% modulo— loops prev/next through the arraydocument.body.style.overflow = 'hidden'— disables scroll when lightbox is open
~50 minutes
grid-template-columns: repeat(3, 1fr) creates 3 equal columns automatically. 1fr means "1 fraction of the available space." The lightbox trick is simple — keep it in the HTML always, but use opacity: 0; pointer-events: none to hide it, then switch to opacity: 1; pointer-events: all when a card is clicked.


