Grid autofilling slots

Is there any way for the grid to fill in the empty slots? https://gyazo.com/4228dd1f37765c2005faca892f8ae6ea As simple as the demo shows. I was wondering.
36 Replies
b1mind
b1mind•2y ago
auto-fit?
Myndi
MyndiOP•2y ago
Uh, wait, how?
Myndi
MyndiOP•2y ago
Myndi
MyndiOP•2y ago
I'm talking about these. The top have grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));.
b1mind
b1mind•2y ago
oh you are using fit yea then its doing what it can do
Myndi
MyndiOP•2y ago
But my question is more around those empty slots. They change depending on the viewport.
b1mind
b1mind•2y ago
you would have to know at what break point and make the last elements react
Myndi
MyndiOP•2y ago
It's going to be impossible 😭 Since they resize automatically, it changes so many times.
b1mind
b1mind•2y ago
yea typically not a practical solution
Myndi
MyndiOP•2y ago
From 1 to 4 empty slots. I mean, flex kind of does this... better. But somebody complained to me grid looks "better" (as they're all always sized the same).
Myndi
MyndiOP•2y ago
Myndi
MyndiOP•2y ago
I was doing it this way.
b1mind
b1mind•2y ago
Yea this would be a case where if that is what you wanted flex does it best
Myndi
MyndiOP•2y ago
Fuck me sadCat
b1mind
b1mind•2y ago
personally I like the grid
Myndi
MyndiOP•2y ago
It's just my mind gets bothered by this.
Myndi
MyndiOP•2y ago
Might be just my OCD.
b1mind
b1mind•2y ago
size them smaller and lil padding ? then you would deal with more on one/two lines than currently
Myndi
MyndiOP•2y ago
The problem is the third one, will remain the same. As there's only 3 elements, and that will make it worse.
b1mind
b1mind•2y ago
also this would be a great case for container queries in the future 😄
Myndi
MyndiOP•2y ago
Myndi
MyndiOP•2y ago
How come?
b1mind
b1mind•2y ago
cause you could then set your own rows/cols based on the size of the parent its going to be a game changer the auto-fit/fill is what it is and great for that one pattern.
Myndi
MyndiOP•2y ago
But wouldn't that be just like a media query?
b1mind
b1mind•2y ago
but I find lots of times if I want specific look I end up defining cols/child areas based on media queries
Myndi
MyndiOP•2y ago
I understand the differences between the two, I just don't understand how it would make it better, at least in my mind.
b1mind
b1mind•2y ago
no cause the parent would expand contract its children could react to that vs more page breakpoints
Myndi
MyndiOP•2y ago
Yeah, media is viewport, container is the container.
b1mind
b1mind•2y ago
so if the container is 500px its always going to display x even if its side by side with another of the same or on top of
Myndi
MyndiOP•2y ago
Yeah. Hmm, I guess less media queries. I bet there has to be a JS that calculates the grid slots, and fills in divs x)
b1mind
b1mind•2y ago
yea then you get into components it brings the real power
Myndi
MyndiOP•2y ago
But it's out of my realm at the moment. I would assume it would have to be a script that views all 4 grids, checks the total amount of columns/rows, and fills in the empty ones with a filler div with whatever class.
Myndi
MyndiOP•2y ago
At least from what I perceive here, it detects the empty rows.
Myndi
MyndiOP•2y ago
Also, a small side topic. But do you know if there's a way for a CSS tooltip not be affected by overflow: hidden?
b1mind
b1mind•2y ago
not if the parent is hidden you would have to pull it out of the flow with absolute or fixed and give it a non hidden relative
Myndi
MyndiOP•2y ago
Hmm, it has absolute. I guess I will have to open a new thread for this LOL
Want results from more Discord servers?
Add your server