Re:CSS Grid Areas
by jdthedisciple on Saturday August 17, 2024 @05:07AM
(#41272951)
gap works with flexbox I believe
.flex {
display: flex;
gap: 8px;
}
This becomes more complicated when the number of divs is dynamic as flex determines position based on siblings. With grid you already have defined the “layout”, and you are just placing the div into the correct position.
Grid does that in both axis too. So although you may be able to kind of replicate the 1d version with flex, it becomes much harder to align in 2D.
I wrote an article about this: https://cssprinciples.com/3/grid/