适合场景
三栏 / 圣杯 / 经典
经典的三栏式网页布局,由固定页头、三列中间区域(左侧导航、主内容、右侧边栏)和固定页脚组成,是Web设计的基础布局范式。
适合场景
三栏 / 圣杯 / 经典
设计重点
使用 CSS Grid 或 Flexbox 实现等高三列
注意事项
禁止三列高度不一致
AI 实现文档
默认用硬性提示词让 AI 直接生成前端;Design Spec 用来理解、改写和审核风格;Creative Brief 用来早期探索方向。
默认使用它:复制后追加具体需求,让 AI 直接生成一致、可落地的前端。
什么时候用
怎么用
STYLEKIT_STYLE_REFERENCE
style_name: 圣杯布局
style_slug: holy-grail-layout
style_source: /styles/holy-grail-layout
# Hard Prompt
## 什么时候用
当你希望 AI 严格按风格规则生成代码时使用。它是生产界面最稳的默认选择。
## 怎么用
- 把完整提示词复制到 ChatGPT、Claude、Cursor 或其他编码助手。
- 在提示词后追加具体产品、页面或组件需求。
- 生成后按禁止项和交互状态检查,确认没有风格漂移。
请严格遵守以下风格规则并保持一致性,禁止风格漂移。
## 执行要求
- 优先保证风格一致性,其次再做创意延展。
- 遇到冲突时以禁止项为最高优先级。
- 输出前自检:颜色、排版、间距、交互是否仍属于该风格。
## Style Rules
你是一个 Holy Grail Layout 布局专家。生成的所有代码必须严格遵守以下约束:
## 绝对禁止
- 禁止三列高度不一致
- 禁止主内容区域过窄
- 禁止忽略响应式折叠
- 禁止侧边栏宽度随内容变化
- 禁止页头页脚不固定
- 禁止卡片大幅位移动画(阅读场景下大幅运动破坏专注)
- 禁止动画 duration 超过 200ms(生产力工具应当响应利落)
- 禁止按钮缺少 active:scale-[0.98](无触觉确认)
- 禁止侧边导航 hover 时有垂直位移(锚定感要求无移动)
## 必须遵守
- 使用 CSS Grid 或 Flexbox 实现等高三列
- 固定页头和页脚 sticky top-0 / sticky bottom-0
- 主内容区 flex-1 自适应宽度
- 左侧导航栏固定宽度 w-60 或 w-64
- 右侧边栏固定宽度 w-64 或 w-72
- 主内容在源码中先于侧边栏
- 响应式折叠侧边栏
- 所有按钮 active:scale-[0.98] active:translate-y-0 + focus:ring-2 focus:ring-[#3b82f6] focus:ring-offset-2
- 内容卡片 hover:-translate-y-0.5 hover:shadow-md(轻量上浮,不干扰阅读)
- 侧边导航 hover 时左边框高亮 hover:border-l-2 hover:border-[#3b82f6](无垂直位移,保持锚定感)
- 所有动画 duration-150 ease-out(生产力工具要求响应利落)
## 布局结构
五个区域:
1. Header:固定顶部,品牌 + 导航
2. Left Sidebar:固定宽度,导航菜单
3. Main Content:自适应宽度,主内容
4. Right Sidebar:固定宽度,辅助信息
5. Footer:固定底部,版权信息
## 实现规则
- 使用 Flexbox:外层 flex flex-col min-h-screen
- 三列区域:flex flex-1
- 侧边栏:固定宽度 w-60 / w-64 flex-shrink-0
- 主内容:flex-1 min-w-0
- 页头:sticky top-0 z-50
- 等高列:三列自动等高
## 响应式
大屏幕(>1024px):完整三列
中等屏幕(768-1024px):隐藏右侧边栏
小屏幕(<768px):所有列垂直堆叠
## Animation & Interaction Rules
### Content Supremacy (Card Float)
- Cards in main content: hover:-translate-y-0.5 hover:shadow-md — minimal, non-distracting float
- NEVER use hover:-translate-y-2 or larger (breaks reading focus)
- Transition: duration-150 ease-out (crisp productivity tool rhythm)
### Navigation Anchoring (Sidebar Links)
- Inactive nav items: hover:border-l-2 hover:border-[#3b82f6] hover:bg-gray-50 — left-border highlight ONLY
- NEVER add vertical displacement to sidebar nav (anchoring feel requires stability)
- Active item: bg-[#3b82f6]/10 text-[#3b82f6] — always-visible active state
### Crisp Performance (Duration Standard)
- All transitions: duration-150 ease-out — productivity tools must feel instant
- NEVER exceed duration-200 for any interactive element
### Button Physics
- Hover: hover:-translate-y-0.5 hover:shadow-[0_4px_10px_rgba(59,130,246,0.4)]
- Active: active:scale-[0.98] active:translate-y-0 active:shadow-none — tactile micropress
- Focus: focus:ring-2 focus:ring-[#3b82f6] focus:ring-offset-2 (WCAG 2.1 AA)
## 自检
1. 页头固定在顶部
2. 三列等高
3. 主内容区自适应
4. 侧边栏固定宽度
5. 页脚始终在底部
6. 响应式折叠正确
---
# Holy Grail Layout (圣杯布局) Design System
> 经典的三栏式网页布局,由固定页头、三列中间区域(左侧导航、主内容、右侧边栏)和固定页脚组成,是Web设计的基础布局范式。
## 核心理念
Holy Grail Layout 是Web设计中追求已久的经典布局方案,包含固定的页头页脚和三列中间内容区。这个名字来源于CSS布局早期实现这种布局的困难程度。
核心理念:
- 结构清晰:页头、三列内容、页脚五个区域各司其职
- 主内容优先:HTML 源码中主内容先于侧边栏,利于 SEO
- 等高列:三列无论内容多少都保持等高
- 灵活适配:侧边栏固定宽度,主内容区自适应
设计原则:
- 视觉一致性:所有组件必须遵循统一的视觉语言,从色彩到字体到间距保持谐调
- 层次分明:通过颜色深浅、字号大小、留白空间建立清晰的信息层级
- 交互反馈:每个可交互元素都必须有明确的 hover、active、focus 状态反馈
- 响应式适配:设计必须在移动端、平板、桌面端上保持一致的体验
- 无障碍性:确保色彩对比度符合 WCAG 2.1 AA 标准,所有交互元素可键盘访问
---
## Token 字典(精确 Class 映射)
### 边框
```
宽度: border
颜色: border-gray-200
圆角: rounded-xl
```
### 阴影
```
小: shadow-sm
中: shadow-sm
大: shadow-md
悬停: hover:shadow-md
聚焦: focus:shadow-sm
```
### 交互效果
```
悬停位移: (无)
悬停缩放: (无)
悬停透明度: hover:opacity-90
过渡动画: transition-colors duration-200
按下状态: active:scale-95
```
### 字体
```
标题: font-semibold tracking-tight
正文: font-sans
等宽: font-mono
```
### 字号
```
Hero: text-2xl md:text-3xl
H1: text-xl md:text-2xl
H2: text-lg md:text-xl
H3: text-base md:text-lg
正文: text-sm md:text-base
小字: text-xs
```
### 间距
```
Section: py-4 md:py-6
容器: px-4 md:px-6
卡片: p-4 md:p-6
小间距: gap-2 md:gap-3
中间距: gap-3 md:gap-4
大间距: gap-4 md:gap-6
```
### 颜色角色
```
背景主色: bg-[#f1f5f9]
背景辅色: bg-white
背景强调色: bg-[#3b82f6], bg-[#10b981], bg-[#f59e0b], bg-[#ef4444]
正文主色: text-[#1e293b]
正文辅色: text-gray-600
正文弱化色: text-gray-400
按钮主色: bg-[#3b82f6] text-white
按钮辅色: bg-gray-100 text-gray-700
```
---
## [FORBIDDEN] 绝对禁止
以下 class 在本风格中**绝对禁止使用**,生成时必须检查并避免:
### 禁止的 Class
- `rounded-none`
- `shadow-2xl`
- `font-black`
- `font-extrabold`
- `text-5xl`
- `text-6xl`
- `text-7xl`
- `text-8xl`
### 禁止的模式
- 匹配 `^rounded-none$`
- 匹配 `^shadow-2xl`
- 匹配 `^text-[5-8]xl`
### 禁止原因
- `rounded-none`: Holy Grail Layout uses moderate rounding (rounded-xl) for a professional look
- `shadow-2xl`: Holy Grail Layout uses subtle shadows befitting a standard web layout
- `text-6xl`: Holy Grail Layout uses moderate type sizes for balanced three-column reading
> WARNING: 如果你的代码中包含以上任何 class,必须立即替换。
---
## [REQUIRED] 必须包含
### 按钮必须包含
```
rounded-lg
font-medium text-sm
transition-colors
```
### 卡片必须包含
```
bg-white
rounded-xl
shadow-sm
border border-gray-100
```
### 输入框必须包含
```
bg-gray-50
border border-gray-200
rounded-lg
text-sm
focus:outline-none
focus:ring-2 focus:ring-[#3b82f6]/20 focus:border-[#3b82f6]
transition-all
```
---
## [COMPARE] Holy Grail Layout 错误 vs 正确对比
以下错误示例只代表“未经过当前风格适配的通用默认值”,不要把错误示例当成视觉建议。
### 按钮
[WRONG] **错误示例**(通用组件库默认样式,不要直接复制):
```html
<button class="{GENERIC_LIBRARY_BUTTON_DEFAULT}">
点击我
</button>
```
[CORRECT] **正确示例**(使用当前风格的 token):
```html
<button class="rounded-lg font-medium text-sm transition-colors bg-[#3b82f6] text-white">
点击我
</button>
```
### 卡片
[WRONG] **错误示例**(未经当前风格适配的通用卡片):
```html
<div class="{GENERIC_LIBRARY_CARD_DEFAULT}">
<h3>{TITLE}</h3>
</div>
```
[CORRECT] **正确示例**(使用当前风格的 card token):
```html
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-4 md:p-6">
<h3 class="font-semibold tracking-tight text-base md:text-lg">{TITLE}</h3>
</div>
```
### 输入框
[WRONG] **错误示例**(未经当前风格适配的通用输入框):
```html
<input class="{GENERIC_LIBRARY_INPUT_DEFAULT}" />
```
[CORRECT] **正确示例**(使用当前风格的 input token):
```html
<input class="bg-gray-50 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-[#3b82f6]/20 focus:border-[#3b82f6] transition-all" placeholder="{PLACEHOLDER}" />
```
---
## [TEMPLATES] Holy Grail Layout 页面骨架模板
以下骨架只使用当前风格的 token。替换 `{PLACEHOLDER}` 时,不要移除或替换这些 token:
### 导航栏骨架
```html
<nav class="bg-[#f1f5f9] text-[#1e293b] border border-gray-200 px-4 md:px-6">
<div class="flex items-center justify-between max-w-6xl mx-auto gap-3 md:gap-4">
<a href="/" class="font-semibold tracking-tight text-base md:text-lg">
{LOGO_TEXT}
</a>
<div class="flex gap-3 md:gap-4 font-sans text-xs">
{NAV_LINKS}
</div>
</div>
</nav>
```
### Hero 区块骨架
```html
<section class="bg-[#3b82f6] text-[#1e293b] py-4 md:py-6 px-4 md:px-6">
<div class="max-w-4xl mx-auto">
<h1 class="font-semibold tracking-tight text-2xl md:text-3xl">
{HEADLINE}
</h1>
<p class="font-sans text-sm md:text-base max-w-xl">
{SUBHEADLINE}
</p>
<button class="rounded-lg font-medium text-sm transition-colors bg-[#3b82f6] text-white">
{CTA_TEXT}
</button>
</div>
</section>
```
### 卡片网格骨架
```html
<section class="bg-[#f1f5f9] text-[#1e293b] py-4 md:py-6 px-4 md:px-6">
<div class="max-w-6xl mx-auto">
<h2 class="font-semibold tracking-tight text-lg md:text-xl">{SECTION_TITLE}</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3 md:gap-4">
<!-- Card template - repeat for each card -->
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-4 md:p-6">
<h3 class="font-semibold tracking-tight text-base md:text-lg">{CARD_TITLE}</h3>
<p class="font-sans text-sm md:text-base text-gray-400">{CARD_DESCRIPTION}</p>
</div>
</div>
</div>
</section>
```
### 表单输入骨架
```html
<input class="bg-gray-50 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-[#3b82f6]/20 focus:border-[#3b82f6] transition-all" placeholder="{PLACEHOLDER}" />
```
### 页脚骨架
```html
<footer class="bg-white text-gray-600 py-4 md:py-6 px-4 md:px-6">
<div class="max-w-6xl mx-auto">
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 md:gap-6">
<div>
<span class="font-semibold tracking-tight text-base md:text-lg">{LOGO_TEXT}</span>
<p class="font-sans text-xs">{TAGLINE}</p>
</div>
<div>
<h4 class="font-semibold tracking-tight text-base md:text-lg">{COLUMN_TITLE}</h4>
<ul class="font-sans text-xs">
{FOOTER_LINKS}
</ul>
</div>
</div>
</div>
</footer>
```
---
## [CHECKLIST] Holy Grail Layout 生成后自检清单
**输出代码前,逐项验证当前风格的 token 和规则。如有违反,先修正再交付:**
### Token 检查
- [ ] 按钮包含: `rounded-lg font-medium text-sm transition-colors`
- [ ] 卡片包含: `bg-white rounded-xl shadow-sm border border-gray-100`
- [ ] 输入框包含: `bg-gray-50 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-[#3b82f6]/20 focus:border-[#3b82f6] transition-all`
### 禁止项检查
- [ ] 没有使用 `rounded-none`
- [ ] 没有使用 `shadow-2xl`
- [ ] 没有使用 `font-black`
- [ ] 没有使用 `font-extrabold`
- [ ] 没有使用 `text-5xl`
- [ ] 没有使用 `text-6xl`
- [ ] 没有使用 `text-7xl`
- [ ] 没有使用 `text-8xl`
### 风格规则检查
- [ ] 使用 CSS Grid 或 Flexbox 实现等高三列
- [ ] 固定页头和页脚 sticky top-0 / sticky bottom-0
- [ ] 主内容区 flex-1 自适应宽度
- [ ] 左侧导航栏固定宽度 w-60 或 w-64
- [ ] 右侧边栏固定宽度 w-64 或 w-72
### 风格漂移检查
- [ ] 没有违反:禁止三列高度不一致
- [ ] 没有违反:禁止主内容区域过窄
- [ ] 没有违反:禁止忽略响应式折叠
- [ ] 没有违反:禁止侧边栏宽度随内容变化
- [ ] 没有违反:禁止页头页脚不固定
### 通用交付检查
- [ ] 响应式布局在手机、平板和桌面下稳定,没有横向溢出
- [ ] 所有交互元素有清晰焦点、可访问名称和 reduced-motion 方案
- [ ] 文本对比度达到 WCAG AA,且没有用颜色单独传递状态
- [ ] 结果仍然能够一眼识别为 Holy Grail Layout
---
## [EXAMPLES] 示例 Prompt
### 1. 管理后台
圣杯布局的管理后台
```
用 Holy Grail Layout 设计一个管理后台,要求:
1. 页头:logo + 搜索框 + 用户头像
2. 左侧导航:图标 + 文字菜单项
3. 主内容:数据卡片 + 表格
4. 右侧边栏:通知列表 + 快捷操作
5. 页脚:版权信息
6. 页头 sticky 固定,三列等高
7. 响应式折叠侧边栏
```
### 2. SaaS 着陆页
生成 圣杯布局风格的 SaaS 产品着陆页
```
Create a SaaS landing page using Holy Grail Layout style with hero section, feature grid, testimonials, pricing table, and footer.
```
### 3. 作品集展示
生成 圣杯布局风格的作品集页面
```
Create a portfolio showcase page using Holy Grail Layout style with project grid, about section, contact form, and consistent visual language.
```
## 绝对禁止(匹配即拒绝)
以下模式一旦出现,视为风格违规——不找借口,直接重写。
- 三列高度不一致
- 主内容区域过窄
- 忽略响应式折叠
- 侧边栏宽度随内容变化
- 页头页脚不固定
- 卡片大幅位移动画(阅读场景下大幅运动破坏专注)
- 动画 duration 超过 200ms(生产力工具应当响应利落)
- 按钮缺少 active:scale-[0.98](无触觉确认)
## 自检清单(交付前逐条确认)
如果任何一条不通过,说明风格漂移了——修改后再交付。
- [ ] 没有紫色到蓝色的渐变
- [ ] 没有使用 Inter / Roboto / Geist 等过度使用的字体
- [ ] 没有嵌套卡片(卡片里面套卡片)
- [ ] 没有在彩色背景上放灰色文字
- [ ] 正文对比度满足 WCAG AA(≥4.5:1)
- [ ] 没有 bounce / elastic 缓动曲线
- [ ] 动效有 prefers-reduced-motion 备选方案
- [ ] 正文行宽不超过 65-75 个字符
- [ ] 没有单侧粗边框装饰(border-left/right accent stripe)
- [ ] 没有渐变文字(background-clip: text)
- [ ] 没有把玻璃态(glassmorphism)当作默认风格
- [ ] 没有 tiny uppercase tracked eyebrow 放在每个 section 标题上面
- [ ] 禁止三列高度不一致
- [ ] 禁止主内容区域过窄
- [ ] 禁止忽略响应式折叠
- [ ] 禁止侧边栏宽度随内容变化
- [ ] 禁止页头页脚不固定更多提示词库:全部 UI 提示词 · Tailwind UI 提示词 · 暗色模式提示词
组件模板
圣杯布局三态按钮:hover:-translate-y-0.5 轻量浮起,active:scale-[0.98] 触觉按压,focus:ring-2 WCAG 焦点环,duration-150 crisp 响应
真实前端完成度
这层检查这个风格是否已经具备真实网站常见的主题、状态反馈、键盘可访问性和性能约束。
总体覆盖
51%
Fallback 规则
暗色模式
0%
缺失组件状态
79%
部分动效规则
70%
部分可访问性
70%
部分性能代价
35%
通用按钮
默认 / 悬停 / 键盘焦点 / 按下 / 禁用
输入框
默认 / 悬停 / 键盘焦点 / 禁用 / 错误
卡片
默认 / 悬停 / 键盘焦点 / 加载中 / 骨架屏
表单
默认 / 键盘焦点 / 禁用 / 加载中 / 错误
常见问题
/* Holy Grail Layout 全局样式 */
/* 圣杯布局容器 */
.holy-grail {
display: flex;
flex-direction: column;
min-height: 100vh;
}
/* 页头 */
.holy-grail-header {
position: sticky;
top: 0;
z-index: 50;
background: white;
border-bottom: 1px solid #e2e8f0;
}
/* 三列主体 */
.holy-grail-body {
display: flex;
flex: 1;
}
/* 左侧导航栏 */
.holy-grail-nav {
width: 240px;
flex-shrink: 0;
background: white;
border-right: 1px solid #e2e8f0;
padding: 1rem;
}
/* 主内容区 */
.holy-grail-main {
flex: 1;
padding: 1.5rem;
min-width: 0;
}
/* 右侧边栏 */
.holy-grail-aside {
width: 256px;
flex-shrink: 0;
background: white;
border-left: 1px solid #e2e8f0;
padding: 1rem;
}
/* 页脚 */
.holy-grail-footer {
background: white;
border-top: 1px solid #e2e8f0;
padding: 1rem 1.5rem;
text-align: center;
}
/* 响应式 */
@media (max-width: 1024px) {
.holy-grail-aside {
display: none;
}
}
@media (max-width: 768px) {
.holy-grail-body {
flex-direction: column;
}
.holy-grail-nav {
width: 100%;
border-right: none;
border-bottom: 1px solid #e2e8f0;
}
}
/* Holy Grail Layout Design Tokens */
:root {
--holy-grail-layout-primary: #1e293b;
--holy-grail-layout-secondary: #f1f5f9;
--holy-grail-layout-accent: #3b82f6;
--holy-grail-layout-glow: rgba(30, 41, 59, 0.3);
}
@keyframes holy-grail-layout-fade-in {
from { opacity: 0; transform: translateY(8px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes holy-grail-layout-pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.7; }
}
.holy-grail-layout-card {
position: relative;
overflow: hidden;
}
.holy-grail-layout-card::before {
content: "";
position: absolute;
inset: 0;
opacity: 0;
transition: opacity 0.3s ease;
background: linear-gradient(135deg, rgba(30, 41, 59, 0.05), transparent);
pointer-events: none;
}
.holy-grail-layout-card:hover::before {
opacity: 1;
}
.holy-grail-layout-gradient {
background: linear-gradient(135deg, #1e293b, #3b82f6);
}
.holy-grail-layout-gradient-text {
background: linear-gradient(135deg, #1e293b, #3b82f6);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.holy-grail-layout-frosted {
backdrop-filter: blur(12px) saturate(180%);
-webkit-backdrop-filter: blur(12px) saturate(180%);
background: rgba(30, 41, 59, 0.08);
}
.holy-grail-layout-accent-corner {
clip-path: polygon(0 0, 100% 0, 100% calc(100% - 2rem), calc(100% - 2rem) 100%, 0 100%);
}
.holy-grail-layout-animate-in {
animation: holy-grail-layout-fade-in 0.5s ease-out both;
}兼容的视觉风格
圣杯布局 是一种布局模式,可以与以下视觉风格搭配使用。
IDE 集成
下载 AI 编码助手的配置文件,使其按照此风格生成代码。
风格包
获取完整的可机器读取风格资源,包括 Design Tokens、Tailwind 预设、CSS 变量和 shadcn/ui 主题。
Metadata
Style metadata including version information
Design Tokens
Figma / Style Dictionary / Tokens Studio 兼容
Tailwind Preset
Tailwind CSS 主题预设,可直接在配置中引用
Global CSS
包含 CSS 变量和基础样式
shadcn Theme
shadcn/ui 主题配置
CSS Variables
纯 CSS 变量,适用于任何项目
SKILL.md
可加载到 Cursor / Claude Code / VS Code 的技能包
Holy Grail Layout 是Web设计中追求已久的经典布局方案,包含固定的页头页脚和三列中间内容区。这个名字来源于CSS布局早期实现这种布局的困难程度。
基于颜色对比度和排版可读性的 WCAG 2.1 合规分析。
综合评分
等级: D - 较差
对比度
| 场景 | 颜色 | 比率 | AA | AAA |
|---|---|---|---|---|
| Text on background | /#1e293b / #f1f5f9 | 13.35:1 | ||
| Secondary text on background | /#4b5563 / #f1f5f9 | 6.9:1 | ||
| Muted text on background | /#9ca3af / #f1f5f9 | 2.32:1 | ||
| Text on secondary background | /#1e293b / #ffffff | 14.63:1 | ||
| Secondary text on secondary | /#4b5563 / #ffffff | 7.56:1 | ||
| Button primary | /#ffffff / #3b82f6 | 3.68:1 | ||
| Text on accent 1 | /#1e293b / #3b82f6 | 3.98:1 | ||
| Alt text on accent 1 | /#4b5563 / #3b82f6 | 2.05:1 | ||
| Text on accent 2 | /#1e293b / #10b981 | 5.77:1 | ||
| Alt text on accent 2 | /#4b5563 / #10b981 | 2.98:1 | ||
| Text on accent 3 | /#1e293b / #f59e0b | 6.81:1 | ||
| Alt text on accent 3 | /#4b5563 / #f59e0b | 3.52:1 | ||
| Text on accent 4 | /#1e293b / #ef4444 | 3.89:1 | ||
| Alt text on accent 4 | /#4b5563 / #ef4444 | 2.01:1 |
可读性
分数
68/100
字号
text-sm md:text-base
字重
font-semibold tracking-tight
行高
default
评分基于 WCAG 2.1 标准。AA 级要求普通文本对比度 4.5:1、大文本 3:1;AAA 级要求普通文本 7:1、大文本 4.5:1。
设计配方
这些精选配方将此风格与布局和动画组合,针对特定场景优化。