Search code examples
htmlcsscss-grid

CSS Grid: divs are spreading out down the column not across the row


Here you can see the problem. I have a div tag that has a sub-grid inside it and I want the albums (which are div tags) to go across the page and not up and down.

Here is my page where you can see my problem:

https://jeremyc2.github.io/Nightingale/index.html

I added grid-auto-flow: row to my css for the element, but it seems to be ignoring that altogether.

.album-strip {
    grid-gap: 20px;
    justify-items: center;
    grid-auto-flow: row;
}

Solution

  • Try this:

    album-strip {
        grid-gap: 20px;
        justify-items: center;
        display: flex;
    }