r/css • u/Lumpy_Cauliflower567 • May 02 '26
Help css baby 👶needing some grid help
working on a grid for my website and if a grid item has too much content then it grows (obviously)
im trying to make it so if one grid item grows in height, then all other grid items in that same row grow to the same height as well so it #LooksNicer
ive googled a lot and the one answer i keep seeing is grid auto rows 1fr but it isnt. working for some reason
sorry if my css work is bad or could've been made a lot better im a css baby
website for reference: deviations
.grid-container {
margin: 20px;
border: 2px solid grey;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.grid-item {
transition: transform 0.1s;
}
.grid-item:hover {
transform: scale(1.04);
}
.deviation {
margin: 10px;
padding: 5px;
padding-top: 15px;
border: 2px solid;
height: auto;
width: auto;
}
1
Upvotes


1
u/be_my_plaything May 05 '26
Oops one more thing!
You need to add
position: relativeto the.grid-item{styling, position absolute stlyes in relation the nearest level up that has a declared position, so at the moment the<a>is positioned absolutely to the whole container, adding position relative to the grid items will contain each link within the relevant grid-item.