When you try a Grid layout, BUG appears in the center of the grid item justify-self align-self content

1. When you try the Grid layout, the grid item justify-self align-self content is centered and the BUG, content is centered, but the background also shrinks to the content size

< hr >

A.html

< div class= "container" >

<div class="test">
    <div class="grid-item grid-item1">1</div>
    <div class="grid-item grid-item2">2</div>
    <div class="grid-item grid-item3">3</div>
    <div class="grid-item grid-item4">4</div>
</div>

< / div >

B css

.container .test {

    display: grid;
    grid-template-columns: 1fr 2fr 1fr ;
    grid-template-rows: 50px 50px 50px;
    grid-template-areas: 
            "header main main " 
            "header main main" 
            "footer footer contrast";
    color: white;        
}
.container{
    width: 300px;
}
.grid-item1{
    grid-area: header;
    background: black;
}
.grid-item2{
    grid-area: main;
    align-self: center;
    justify-self: center;
    background: red;
}
.grid-item3{
    grid-area: footer;
    background: yellow;
}
.grid-item4{
    grid-area: contrast;
    background: blueviolet;
}
@media screen and (max-width:750px){
    .container{
        background: red;
    }
    .container .test{
        display: grid;
        grid-template-columns: 1fr 2fr 1fr ;
        grid-template-rows: 50px 50px 50px;
        grid-template-areas: 
                "header header header" 
                "main main main" 
                "footer footer contrast";
        color: white;        
    }
}



< hr >
  1. item2 plus justify-self align-self effect

clipboard.png

clipboard.png

rookie sincerely solve the problem!

Css
Dec.18,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e597dc-45515.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e597dc-45515.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?