



justify-selfプロパティは、コンテナ内の個別アイテムの横方向(主軸方向)の揃え位置を指定する際に使用します。
コンテナ内の個別アイテムの縦方向(交差軸方向)の揃え位置を指定する場合は、align-selfプロパティを使用します。
.sample {
display:grid;
grid-template-columns:auto 1fr auto;
grid-template-rows:50px;
width:300px; background-color:white; border:1px solid black;
}
.hidari {grid-column:1; background-color:yellow;}
.naka {grid-column:2; background-color: orange;}
.migi {grid-column:3; background-color:pink;}
<h5>中ボックスにjustify-self:center;を指定。左50px・中50px・右50px。</h5> <div class="sample"> <div class="hidari" style="width:50px;">左</div> <div class="naka" style="width:50px; justify-self:center;">中</div> <div class="migi" style="width:50px;">右</div> </div> <h5>中ボックスにjustify-self:center;を指定。左50px・中50px・右100px。</h5> <div class="sample"> <div class="hidari" style="width:50px;">左</div> <div class="naka" style="width:50px; justify-self:center;">中</div> <div class="migi" style="width:100px;">右</div> </div> <h5>中ボックスにjustify-self:center;を指定。左50px・中50px・右150px。</h5> <div class="sample"> <div class="hidari" style="width:50px;">左</div> <div class="naka" style="width:50px; justify-self:center;">中</div> <div class="migi" style="width:150px;">右</div> </div>