LAYOUT
12 栏栅格系统12-Column Grid System
把页面宽度切成 12 等份,任何元素都跨整数份排列。所有精致布局背后的隐形骨架。
中英对照
- 中文
- 12 栏栅格系统
- 英文
- 12-Column Grid System
- 别名
- 十二栅格、Grid System、栅格布局
- 一句话
- 把页面宽度切成 12 等份,任何元素都跨整数份排列。所有精致布局背后的隐形骨架。
效果预览
5 栏 · 主内容
适合用在哪
整站布局的基础设施;先定栅格再排版,间距才不会乱。
不适合:一次性营销长页里每个区块都「重新发明」栏数:栅格是全站约定,局部脱离 12 栏会让间距体系崩掉;也不要把 12 栏画进每个组件内部(按钮组不需要 12 栏)。
和相近模式的区别
便当格布局Bento Grid
便当格是表现层的不对称网格;12 栏是更底层的隐形骨架,便当格、分栏英雄、三栏特性都可以落在 12 栏上。
间距刻度Spacing Scale
间距体系管的是 4/8px 节奏;12 栏管的是水平占位。两者要一起用:先定容器与 gap,再 span。
容易踩的坑
- 栅格 gap 与组件内间距不在同一刻度上,24px 栅格配 18px 卡片内边距,版面显得松垮。
- 用 1fr 但子元素含长单词或宽表格,列被撑开导致整行错位,应改用 minmax(0,1fr)。
- 只在桌面端设计 12 栏,8 栏断点下的 span 组合未定义,平板布局一团乱。
设计提示词 · Prompt
12 栏栅格系统(12-Column Grid):display:grid; grid-template-columns:repeat(12,1fr); gap:24px,容器最大宽度 1200-1280px 居中,两侧留 24-40px 安全边距。元素用 grid-column:span N 占位(6+6、5+7、4+4+4、8+4 是最常用组合)。响应式断点:≥1024px 用满 12 栏、768-1023px 折成 8 栏、<768px 全部 span 12。所有版式决策先在栅格上想清楚,再动手写样式。
12-Column Grid: display:grid; grid-template-columns:repeat(12,1fr); gap:24px, container max width 1200-1280px centered, with 24-40px safe margins on both sides. Elements take space with grid-column:span N (6+6, 5+7, 4+4+4, and 8+4 are the most common combinations). Responsive breakpoints: ≥1024px uses all 12 columns, 768-1023px folds into 8 columns, <768px everything spans 12. Think every layout decision through on the grid first, then start writing styles.
可复制 CSS
自包含的最小实现,粘贴到空白页面即可生效;类名可以按项目规范改名。
/* 容器 + 12 栏;子项用 span */
.grid12 {
display: grid;
grid-template-columns: repeat(12, 1fr);
gap: 24px;
width: min(1240px, calc(100% - 64px));
margin-inline: auto;
}
.grid12__span-6 { grid-column: span 6; }
.grid12__span-5 { grid-column: span 5; }
.grid12__span-7 { grid-column: span 7; }
.grid12__span-4 { grid-column: span 4; }
.grid12__span-8 { grid-column: span 8; }
.grid12__span-12 { grid-column: span 12; }
@media (max-width: 1023px) {
.grid12 { grid-template-columns: repeat(8, 1fr); width: min(100% - 48px, 960px); }
.grid12__span-5,
.grid12__span-6,
.grid12__span-7,
.grid12__span-8 { grid-column: span 8; }
.grid12__span-4 { grid-column: span 4; }
}
@media (max-width: 767px) {
.grid12 { grid-template-columns: 1fr; width: calc(100% - 32px); gap: 16px; }
.grid12 [class*="grid12__span-"] { grid-column: span 1; }
}
演示 HTML 结构
<div class="s d-grid12"> <div class="d-grid12__cols"><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i></div> <div class="d-grid12__a">5 栏 · 主内容</div> <div class="d-grid12__b"></div> <div class="d-grid12__c"></div> <div class="d-grid12__d"></div> </div>
常见问题
12 栏栅格系统的英文是什么?
12 栏栅格系统的英文是 12-Column Grid System。常见英文别名还包括 Grid System。
12-Column Grid System 的中文是什么?
12-Column Grid System 的中文是「12 栏栅格系统」。常见中文别名还包括 十二栅格、栅格布局。把页面宽度切成 12 等份,任何元素都跨整数份排列。所有精致布局背后的隐形骨架。
为什么是 12 不是 10 或 16?
12 能整除 2、3、4、6,常见组合(6+6、4+4+4、3+9、5+7)都好算。16 栏更细但认知成本高;10 栏不好三等分。
设计稿里的栏线要画进生产 CSS 吗?
不用。生产只用 grid-template-columns:repeat(12,1fr) + span;栏线是设计与评审时的对齐工具。调试阶段可用半透明伪元素临时可视化。
常见搭配
同一页面里经常和「12 栏栅格系统」一起出现的模式,可以收藏后用「组合收藏为整页提示词」一起交给 AI。
所属设计风格
「12 栏栅格系统」是这些整体设计风格的常见组成部分,在设计风格词典里可以看到整页效果。