CSS Grid布局-项目对齐
html公开前 25 行,完整代码需登录
<style>
.grid {
display: grid;
grid-template-columns: repeat(3, 150px);
grid-template-rows: repeat(3, 150px);
gap: 10px;
background-color: #e8e8e8;
padding: 10px;
justify-content: center;
align-content: center;
min-height: 500px;
}
.grid-item {
background-color: #2196F3;
border: 1px solid #000;
color: white;
font-size: 20px;
font-weight: bold;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
}
.grid-item:nth-child(1) {
justify-self: start;