I'm working with CSS Grid and I noticed a behavior I don't fully understand.
body {
background: rgb(58, 58, 59);
}
.grid-parent {
height: 90vh;
display: grid;
gap: 5px;
grid-template-columns: repeat(4, 1fr);
grid-template-rows: 1fr 2fr 4fr;
}
.grid-parent>* {
background-color: rgb(102, 102, 102);
}
.clildren-a {
grid-row: 1 / 4;
grid-column: 1 / 2;
}
.clildren-b {
grid-row: 1 / 2;
grid-column: 2 / 4;
}
.clildren-c {
grid-row: 1 / 4;
grid-column: 4 / 5;
}
.clildren-d {
grid-row: 2 / 4;
grid-column: 2 / 3;
}
.clildren-e {
grid-row: 2 / 4;
grid-column: 3 / 4;
}
.clildren-f {
grid-row: 1 / 4;
width: 90px;
}
<body>
<div class="grid-parent">
<div class="clildren-a">A</div>
<div class="clildren-b">B</div>
<div class="clildren-c">C</div>
<div class="clildren-d">D</div>
<div class="clildren-e">E</div>
<div class="clildren-f">f</div>
</div>
</body>
Even though I defined grid-template-columns: repeat(4, 1fr); (4 columns), I notice that the browser creates 6 column grid lines instead of 5, seemingly to accommodate .children-f.
Why is an extra column line created?
How should I properly place .children-f without creating extra implicit columns?