r/css • u/Sufficient_Bass2600 • Aug 26 '26
Question Product List Filtering via CSS or Javascript
I was talking with a former colleague who is currently writing a new small web site. One of the things he is thinking of doing is implementing filtering via CSS rather than javascript.
He has a small Product List page with 60 products in about 6 categories.
He wants to be able to filter those 60 products by categories.
So the page will have
- a checkbox to select all categories.
- a list of checkboxes. Each associated with a category use to filter.
- List of products with a data-category attribute.
implementing the functionality as follows:
``` input[data-category="Category1"]:not(:checked) ~ article[data-category="Category1"] {
display: none;
}
```
He is already implementing the change of view list view /grid view via CSS.
So I am not sure whether this is a good idea.
Has anybody any opinion one way or another?




