Lofi_PewPew's Collecion of Curiosities
this is the code i use for my responsive, tag-filtered art gallery.
filters
download (v1.1)
you will need to save
- this html file (add
view-source:before the url, copy it to your code editor) - reset.css
- gallery.css
how to use
to add a new filter group, copy the
.button-group div and change the
data-filter-group.
to add a new filter to an existing group, copy the
.button button and change the
data-filter to the class you will use to tag those
elements. leave it blank to make a "show all" option.
i recommend using either 2 or 3 columns. if you want more, i
would add another breakpoint for the
--grid-item variable to avoid images getting too
small.
disclaimer
this layout uses isotope for tag filtering, masonry (included in isotope) to position the grid elements into cascading columns, and biggerpicture for the lightbox.
this uses a lot of js! this will take a longer time to load for
slower connections. i would strongly recommend optimizing
your images if you plan on using this. a similar tag filtering
system can be achieved without js via radio checkboxes and some
:has(#id:checked) and
display: none css lines, and you can get columns
like this with css columns, but you need a js
library like masonry to have the next item fill to the next
highest position.
if your gallery has a lot of images, i'd also recommend using this template with a static site generator; there are many lines of html for each element and adding new items manually would be a pain, especially if you want to change something across all items down the road. in my setup, i add my new art entries to a json file and 11ty generates the list elements for me.
you are free to use this without credit, i own none of the important stuff. play around with the css and create your own visual style using this as a base. i learned webdev by stealing and you should too!
-
element #1 with classes tag1 y2025 -
element #2 with classes tag2 y2024 -
element #3 with classes tag3 y2024 -
element #4 with classes tag1 tag2 tag3 y2022 -
if you want an element to always appear no matter the applied
filters, you need to assign it every filter class (e.g.
class="tag1 tag2 tag3 y2025 y2024 y2023 y2022")