CSS Grid Layout Overflowing and Resizing
I've made a grid layout with some containers and when I put content into each container the layout breaks and isn't stable.

8 Replies

The boxes should have a fixed size
Please check out #how-to-ask-good-questions and share your code in any other form than screenshots
Your elements are changing size because without defined dimensions, they will fill the space available to them.
The columns are defined in terms of fr units, where 1fr is a proportional fraction of the available space after accounting for anything which takes up a fixed amount of space... such as the content of the other children.
To preserve the aspect ratio and proportions of the whole grid, you need to use a less 'permissive' unit.
Grid and fr units are designed to resize in this way to prevent content overflows.
Declaring your rows would be a good place to start. If you do want a truly fixed size then you'll need something like
px
or em
instead of fr
that worked
thanks
