AI UP LAB / 基础与素材Foundations & assets / v1.2.1

栅格、间距与容器Grid, spacing & containers

用容器与间距组织阅读顺序,让同一套内容在手机和桌面自然重排。Use containers and spacing to preserve reading order as the same content reflows between mobile and desktop.

查看示例Explore exampleMarkdown ↓

01 / LIVE SPECIMEN

实际示例Working example

示例 / 可操作的状态标有按钮EXAMPLE / Interactive states have controls

02 / STRUCTURE & RULES

组成与使用规则Anatomy & usage

  1. 01外层容器控制页面宽度与安全边距。The outer container sets content width and safe gutters.
  2. 02内层栅格按内容类型决定列数,卡片内部保持自己的结构。The inner grid chooses columns by content type; cards preserve their internal anatomy.
  3. 03相近内容使用小间距,不同主题使用较大区块间距。Use tighter spacing for related content and larger gaps between topics.

必须遵守Required behavior

  • 采用 CSS 像素与响应式栅格;本站不是按天猫 750px 设计稿直接缩放的 App 页面。Use CSS pixels and responsive grids; this web system does not directly scale a 750px Tmall app canvas.
  • 新建布局先保证单列阅读顺序,再增加列数。Establish a single-column reading order before adding columns.
  • 使用 minmax(0, 1fr) 和可换行文案,避免内容撑破容器。Use minmax(0, 1fr) and wrapping copy to prevent overflow.
  • 分类页标题、简介、资源数量之后直接进入内容,不插入大面积功能区。On category pages, follow title, description, and count directly with content.

推荐做法Do

同一容器中的标题、资源网格和底部操作对齐。Align headings, resource grids, and bottom actions to one container.

避免做法Avoid

为了凑满首屏把标题区拉高,或让卡片宽度由最长英文决定。Inflate the heading area to fill the viewport, or let the longest English word set card width.

03 / PARAMETERS

参数与状态Parameters & states

参数Parameter取值Value用法Usage
layout.maxWidth1344px本站宽内容容器上限。Maximum width for the site's wide content container.
layout.gutter≥ 14px窄屏左右最小边距;宽屏由居中容器增加留白。Minimum narrow-screen gutters; centered wide containers add outer space.
layout.breakpoints700 / 1050px主要重排点;组件也应检查 320px 的长文案。Primary reflow boundaries; also test long copy at 320px.
spacing4 · 8 · 12 · 16 · 20 · 24 · 32 · 48 · 64先按语义分组,再从间距阶梯中选择。Group by meaning, then select a spacing step.

手机Mobile

单列内容;图片与文本可横向组成紧凑卡片,保持 DOM 阅读顺序。Single-column content; compact cards may align image and copy horizontally while preserving DOM order.

桌面Desktop

资源网格使用多列;首页主推与补充推荐按重要性分配宽度。Use multi-column resource grids; give the homepage lead more space than supporting picks.

代码映射与 AI 使用Code mapping & AI use

先读取本项规则,再通过下列映射找到已有实现。调整共用组件时,同步检查依赖项。Read these rules, then locate the existing implementation below. Check dependencies when changing shared components.

实现片段Implementation fragment

组件片段需放入相应 Astro 文件上下文,按代码映射补齐导入。Place component fragments in the corresponding Astro context and complete imports from the code mappings.

.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
@media (max-width: 700px) {
  .resource-grid { grid-template-columns: minmax(0, 1fr); }
}

使用的设计变量Design tokens

--lab-width-content--lab-space-16--lab-space-24

相关规则Related rules

给 AI 的完整规则文本Full rules for AI
# 栅格、间距与容器 / Grid, spacing & containers

ID: layout
Version: 1.2.1

用容器与间距组织阅读顺序,让同一套内容在手机和桌面自然重排。

Use containers and spacing to preserve reading order as the same content reflows between mobile and desktop.

## Anatomy
- 外层容器控制页面宽度与安全边距。
  The outer container sets content width and safe gutters.
- 内层栅格按内容类型决定列数,卡片内部保持自己的结构。
  The inner grid chooses columns by content type; cards preserve their internal anatomy.
- 相近内容使用小间距,不同主题使用较大区块间距。
  Use tighter spacing for related content and larger gaps between topics.

## Parameters
- layout.maxWidth: 1344px
  本站宽内容容器上限。
  Maximum width for the site's wide content container.
- layout.gutter: ≥ 14px
  窄屏左右最小边距;宽屏由居中容器增加留白。
  Minimum narrow-screen gutters; centered wide containers add outer space.
- layout.breakpoints: 700 / 1050px
  主要重排点;组件也应检查 320px 的长文案。
  Primary reflow boundaries; also test long copy at 320px.
- spacing: 4 · 8 · 12 · 16 · 20 · 24 · 32 · 48 · 64
  先按语义分组,再从间距阶梯中选择。
  Group by meaning, then select a spacing step.

## Rules
- 采用 CSS 像素与响应式栅格;本站不是按天猫 750px 设计稿直接缩放的 App 页面。
  Use CSS pixels and responsive grids; this web system does not directly scale a 750px Tmall app canvas.
- 新建布局先保证单列阅读顺序,再增加列数。
  Establish a single-column reading order before adding columns.
- 使用 minmax(0, 1fr) 和可换行文案,避免内容撑破容器。
  Use minmax(0, 1fr) and wrapping copy to prevent overflow.
- 分类页标题、简介、资源数量之后直接进入内容,不插入大面积功能区。
  On category pages, follow title, description, and count directly with content.

## States
- 手机 / Mobile: 单列内容;图片与文本可横向组成紧凑卡片,保持 DOM 阅读顺序。
  Single-column content; compact cards may align image and copy horizontally while preserving DOM order.
- 桌面 / Desktop: 资源网格使用多列;首页主推与补充推荐按重要性分配宽度。
  Use multi-column resource grids; give the homepage lead more space than supporting picks.

## Do / Avoid
- Do: 同一容器中的标题、资源网格和底部操作对齐。 / Align headings, resource grids, and bottom actions to one container.
- Avoid: 为了凑满首屏把标题区拉高,或让卡片宽度由最长英文决定。 / Inflate the heading area to fill the viewport, or let the longest English word set card width.

## Code mapping
- src/styles/global.css: 容器与目录栅格 / Containers and directory grid
- src/styles/editorial.css: 响应式首页布局 / Responsive editorial layout

## Dependencies
foundations

## Acceptance
- 320 / 390 / 768 / 1440 px 均无页面横向溢出。
  No page overflow at 320/390/768/1440px.
- 改变列数不会改变阅读顺序或隐藏重要操作。
  Changing columns does not reorder reading or hide important actions.
- 分类页第一张内容卡片在手机首屏可见。
  The first category card is visible in the mobile viewport.

## Implementation example
```
.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
@media (max-width: 700px) {
  .resource-grid { grid-template-columns: minmax(0, 1fr); }
}
```

## Reference
Method reference: https://tmall-design.com/#style/layout/grid
Rules, parameters, examples, and branding in this file are specific to AI UP LAB.
按任务整理 AI 工作说明 →Assemble a task-specific brief →

交付前检查Before delivery

  • 320 / 390 / 768 / 1440 px 均无页面横向溢出。No page overflow at 320/390/768/1440px.
  • 改变列数不会改变阅读顺序或隐藏重要操作。Changing columns does not reorder reading or hide important actions.
  • 分类页第一张内容卡片在手机首屏可见。The first category card is visible in the mobile viewport.

方法参考与适用边界Reference & scope

参考 Tmall Design 将规则、映射与代码关联的组织方法。本页参数、示例和品牌资产为 AI UP LAB 自身规范。Inspired by Tmall Design’s organization of rules, mappings, and code. Parameters, examples, and brand assets here are specific to AI UP LAB.

Tmall Design ↗