I am building a simple CSS grid layout that looks like this...
.container {
display:grid;
grid-template-columns:1fr 1fr 1fr 1fr;
}
.col1 {
padding:20px;
background:red;
color:white;
text-align:center;
}
.col2 {
padding:20px;
background:green;
color:white;
text-align:center;
}
.col3 {
padding:20px;
background:blue;
color:white;
text-align:center;
}
.col4 {
padding:20px;
background:gray;
color:white;
text-align:center;
}
<div class="container">
<div class="col1">
Column 1
</div>
<div class="col2">
Column 2
</div>
<div class="col3">
Column 3
</div>
<div class="col4">
Column 4
</div>
</div>
I am trying to make it so that when any of the columns are hovered over, they change width so that the hovered column takes up 2fr.
I know with flexbox I can set the width of the item in the item itself, but with grid I set item widths on the container.
Is there a way to set them on the items?