Blogger Information
Blog 19
fans 0
comment 0
visits 10674
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
grid布局常用属性
无名小辈
Original
901 people have browsed it

1、创建grid容器

  1. display:grid;

2、设置容器中单元格的数量

  1. grid-template-rows: repeat(3,10em);
  2. grid-template-columns: repeat(3,10em);

3、排列顺序

  1. /* 按照列排序 */
  2. grid-auto-flow: column;
  3. /* 按照行排序 */
  4. grid-auto-flow: row;

4、项目超出单元格设定数量时,超出部份,行和列的显示方式

  1. /* 超出部份,行设置为10em */
  2. grid-auto-rows: 10em;
  3. /* 超出部份,列设置为10em */
  4. grid-auto-columns: 10em;

5、每个单元格之间的间距

  1. /* 行间距,列间距 */
  2. gap:5px 10px;

6、项目相对于容器,剩余空间的分配方式,垂直排列、水平排列

  1. /* 顶部对齐、居中对齐 */
  2. place-content: start center;
  3. /* 两端对齐,分散对齐 */
  4. place-content: space-between space-around;

7、项目相对于单元格,垂直排列、水平排列

  1. place-items: end center;

8、项目占用单元格的数量,行开始,列开始,行结束,列结束

  1. grid-area: 2 / 2 / span 2 / span 3;

9、单独设置项目,相对于单元格的对齐方式

  1. place-self: start center;
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post