赞
踩
- <style>
- .box{
- width: 400px;
- height: 400px;
- background-color: skyblue;
- display: grid;
- grid-template-columns: repeat(3,100px);
- grid-template-rows: repeat(3,100px);
- }
- .div4{
- grid-row: 2/4;
- grid-column: 1/3;
- }
- </style>
- </head>
- <body>
- <div class="box">
- <div>
- <img src="./images/15_03.jpg" alt="">
- </div>
- <div>
- <img src="./images/15_04.jpg" alt="">
- </div>
- <div>
- <img src="./images/15_05.jpg" alt="">
- </div>
- <div class="div4">
- <img src="./images/15_08.jpg" alt="">
- </div>
- <div>
- <img src="./images/15_09.jpg" alt="">
- </div>
- <div>
- <img src="./images/15_10.jpg" alt="">
- </div>
- </div>
grid-template-columns: repeat(3,100px);三列,每列宽100px;
grid-template-columns:100px 1fr 150px;1fr=大盒子-固定值
grid-template-rows: repeat(3,100px);三行,每行高100px
grid-template-rows: 1fr 1fr 1fr; 平分大盒子
grid-template-rows: 1fr 3fr 2fr;每行所占份数
grid-row: 2/4;网格行的起始终止线;
grid-column: 1/3;网格列的起始终止线;
效果图
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。