ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
## 4,grid网格布局 阮一峰css的grid ![](https://img.kancloud.cn/a1/9c/a19c05bbfc3f33fe8be2d271e1113b39_794x368.png) - display: grid 设为网格布局以后,容器子元素(项目)的float、display: inline-block、display: table-cell、vertical-align和column-*等设置都将失效。 - 划分行和列。 grid-template-columns属性定义每一列的列宽,grid-template-rows属性定义每一行的行高,除了使用绝对单位,也可以使用百分比。 - repeat() grid-template-columns: repeat(3, 33.33%); grid-template-columns: repeat(2, 100px 20px 80px); - auto-fill 关键字 grid-template-columns: repeat(auto-fill, 100px); // 每列宽度100px,然后自动填充,直到容器不能放置更多的列