Grid autopositioning

Can someone explain to me how to autoposition items in a grid? At the moment I’m using grid-column and grid-row properties. Is there a way around this? Without having to write a code for every new grid item. Especially since my site is going be dynamic, the items are going to be created dynamically using PHP.

You can use grid-template-coulmns and grid-template-rows properties on the gird itself.
These properties will set the grid structure without having to explicitly set column and row for each item.
I highly recommend this guide https://css-tricks.com/snippets/css/complete-guide-grid/

1 Like

there are two elements in css grid. one is the parent that is holding all the grids, one is the grid itself.
it looks something like this:

grid-row and grid-column are for styling the individual items.
if you want a grid layout, you gotta start from the bigger parent div.

see the comment above and the link to it to see how to use css grid.

Alright thanks everyone