"space-between" with grid

Hey, is there a way to define the space-between value utilized with flex for grid? I tend to use the method found in the codepen below however i was wondering if there was a flat out way of separating grid items this way similar to justify-content: space-between, or is what’s found in the codepen a valid substitute? Thanks in advance. https://codepen.io/deerCabin/pen/gOyXBqV
4 Replies
ἔρως
ἔρως4mo ago
there are other ways of doing it, but this is a really clean solution however, instead of the data-separated attribute, i would just use the :last-child selector, for that specific example you can also have grid areas and manually code it to do what you need
snxxwyy
snxxwyy4mo ago
Ah, got it, thank you for your help and feedback.
Kevin Powell
Kevin Powell4mo ago
I like using margins for that, since we can use it in both grid and flex. I tend to call it something like push-right or something like that though, because, if you use it with flexbox, it'll push all items over if there are any after it, or if you have more columns in your grid, it's more like a justify-self: end
snxxwyy
snxxwyy4mo ago
Ah yeah that makes sense, I’ll keep that in mind, thank you.