<h1>pxを利用</h1>
<div class="container template-columns1">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
    <div class="item">5</div>
    <div class="item">6</div>
</div>

<h1>frを利用</h1>
<div class="container template-columns2">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
    <div class="item">5</div>
    <div class="item">6</div>
</div>

<h1>repeatを利用した短縮記法</h1>
<div class="container template-columns3">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
    <div class="item">5</div>
    <div class="item">6</div>
</div>
.container {
    display: grid;
    grid-template-rows: 50px 100px;
}

.template-columns1 {
    grid-template-columns: 50px 50px 100px;  
}

.template-columns2 {
    width: 200px;
    grid-template-columns: 1fr 1fr 2fr;  
}

.template-columns3 {
    width: 200px;
    grid-template-columns: repeat(2, 1fr) 2fr;  
}

.item:nth-child(1) {
    background-color: #fff001;
}

.item:nth-child(2) {
    background-color: #00a5e7;
}

.item:nth-child(3) {
    background-color: #00984b;
}

.item:nth-child(4) {
    background-color: #cd5638;
}

.item:nth-child(5) {
    background-color: #fff001;
}

.item:nth-child(6) {
    background-color: #00a5e7;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.