Skip to main content
DevTools24

CSS Grid 生成器

可视化构建 CSS Grid 布局。定义列、行、间距并查看带有生成的 CSS 代码的实时预览。

1
2
3
4
5
6
.container {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 10px;
  justify-items: stretch;
  align-items: stretch;
}

CSS Grid Layout - 技术详情

CSS Grid is a two-dimensional layout system for the web. Define rows and columns with grid-template-rows and grid-template-columns. Use fr units for flexible sizing, repeat() for patterns, and gap for spacing between cells.

命令行替代方案

/* Common grid patterns */\n.container {\n  display: grid;\n  grid-template-columns: repeat(3, 1fr);\n  gap: 20px;\n}

参考

查看官方规范