I have the following grid that are used to show filter options:
+------------------------------------------------------------------------------------------+
| |
| +-----------+ +-----------+ +-----------+ +-----------+ +-----------+ +-----------+ |
| | 1 | | 2 | | 3 | | 4 | | 5 | | 6 | |
| +-----------+ +-----------+ +-----------+ +-----------+ +-----------+ +-----------+ |
| |
+------------------------------------------------------------------------------------------+
Here's the relevant CSS:
min-height: 0; /* NEW */
min-width: 0; /* NEW; needed for Firefox */
display: grid;
grid-gap: 1rem;
grid-template-columns: repeat(6, 1fr);
@media (max-width: 991.98px) {
grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 575.98px) {
width: 100%;
grid-gap: 0;
}
Now I have a new requirement that requires me do hide any filter options which would result in an empty list. Suppose only items 1, 2 and 3 (it could be any of the six in any quantity though) are to be shown, then currently I have:
+------------------------------------------------------------------------------------------+
| |
| +-----------+ +-----------+ +-----------+ |
| | 1 | | 2 | | 3 | |
| +-----------+ +-----------+ +-----------+ |
| |
+------------------------------------------------------------------------------------------+
What I need is for it to show like this:
+------------------------------------------------------------------------------------------+
| |
| +-----------+ +-----------+ +-----------+ |
| | 1 | | 2 | | 3 | |
| +-----------+ +-----------+ +-----------+ |
| |
+------------------------------------------------------------------------------------------+
Can I reach this result with CSS grid or should I use something else?