Please see this playground https://play.tailwindcss.com/SMkXmO9Mo8
As the text say I want the grid row items to distribute evenly and edge to edge in a container with flexible width.
justify-content: space-between;
or tailwinds justify-beween
has no effect on grid only flex.
2
Answers
Your are looking for justify-items-center. This centers all your grid items to the center of their cell. However, item 6 still won’t be at the edge of the container because item 6 doesn’t occupy all the space of it’s cell. Maybe ressort to grid cells with fit-content and use gap
But basically you can’t. Each child is positioned inside it’s own grid-column which has no spatial relationship to the child’s position in the grid
You would have to institute a
column-gap
based on the number of columns and the width of the children.. so something likecolumn-gap: calc((100% - (6 * 2em)) / 5)
.