css
ul,li{
list-style: none;
margin: 0;
padding: 0;
background-color: #eee;
}
ul{
width: 240px; height: 240px;
}
.li{
outline: 1px solid #fff;
display: flex;
}
/* 只有一个图片 */
.li:only-child{
height: 100%;
align-items: center;
}
/* 2个图片 */
.li:first-child:nth-last-child(2), .li:first-child:nth-last-child(2) + li{
width: 50%; height: 50%;
}
.li:first-child:nth-last-child(2) + li{
margin-left: auto;
}
/* 3个图片 */
.li:first-child:nth-last-child(3), .li:first-child:nth-last-child(3) ~ li{
width: 50%;
}
.li:first-child:nth-last-child(3){
margin: auto;
}
.li:first-child:nth-last-child(3) ~ li{