grid-row-columns: image overflowing out of grid item in grid layout.
Hello everyone. I am trying to create a grid layout that shows 3 columns vertically and than 3 columns horizontally using grid-template-rows. I don't want to achieve this using the auto-fit or auto-fill attributes with grid-template-column. I want to be able to define the height of my rows within the grid layout. The issue is that my image keeps flowing out the bottom. I can't understand why this is happening or a solution. Any ideas? I am coding in react. Code sandbox: https://codesandbox.io/p/sandbox/xy3l2p
8 Replies
Here is my css:
Could you post this to a code review app, like CodeSandbox, as mentioned here (https://discord.com/channels/436251713830125568/1022288836715356180/1022288836715356180)?
Yes here it is. I have put the issue into a code sandbox: https://codesandbox.io/p/sandbox/xy3l2p
grid-template-rows: repeat(3, minmax(0, 300px));
<-- try replacing this with absolutely nothing at all?
in fact, why are you even using grid-template-rows
?I don't know. I want to have 3 cards stacked vertically on smaller screens and than 3 cards stacked horizontally on larger screens , on my website design. I wanted to use grid to achieve the horizontal design on larger screens. Do you think I should not use grid for small screen, and than use grid for large screen?
you can use grid, but just set the columns for desktop
without touching the rows
Yeah. I have done this and everything is working. I’m still interested why in this case the image flowed out the bottom. Do you have any idea why?
yes: you limited the height but kept the default
overflow: auto
so, it just overflowed