I was wondering if there is a way to assign a dynamic number of rows and columns to a Grid layout without Javascript? Every example I've seen has also included some Javascript and as of now I'm working on a bare knowledge of only HTML and CSS (a student). What I am trying to achieve is that as I add content, I don't want to have to create new rows in my CSS. I don't know if it's possible either, but it'd be nice if I could repeat just two rows as a basic layout, I want alternating colors between my rows and no other properties than to use them to place other content.
EDIT:
Well, I have tried to establish a grid with
<div class="grid-container"></div>
<div class="grid-item1"></div>
<div class="grid-item2"></div>
<div class="grid-item3"></div>...
The problem with going about it this way is I have to manually add a new grid item for every row or column I want. I found a partial solution in repeat.
.grid-container {
grid-template-rows: repeat(20, 10px);
}
But I'm unsure if this will mean that I will be left with scrolling white areas when I run out of rows and I will have to change my CSS, which I expect, or whether I will just have to go back to adding manually new grid-items. I am trying to find a way to specify to my CSS file, make an unknown number of rows so that as I add content, I don't have to manually add grid-items.