Responsive Layout

v1.0.0

Designs responsive layouts using mobile-first or desktop-first breakpoints, flex/grid, rem/vw units, and handles cross-device and safe area adaptations.

0· 128·0 current·0 all-time
bywangzhiming@wangzhiming1999

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for wangzhiming1999/responsive-layout.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "Responsive Layout" (wangzhiming1999/responsive-layout) from ClawHub.
Skill page: https://clawhub.ai/wangzhiming1999/responsive-layout
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install responsive-layout

ClawHub CLI

Package manager switcher

npx clawhub@latest install responsive-layout
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name, description, README, and SKILL.md all describe responsive layout guidance (breakpoints, flex/grid, rem/vw, safe-area) and the files request no unrelated resources or credentials. The required surface (none) is proportionate to the stated purpose.
Instruction Scope
SKILL.md provides step-by-step guidance, question prompts, and code snippets for diagnosing and creating responsive layouts. It may instruct the agent to inspect user-provided code when debugging a layout issue (expected for this kind of skill). It does not instruct reading system files, environment variables, or sending data to external endpoints.
Install Mechanism
No install spec and no bundled code — instruction-only — so nothing is downloaded or written to disk. This is the lowest-risk install profile.
Credentials
No environment variables, credentials, or config paths are required. The skill does not request any tokens or secrets; this is appropriate for a documentation/assistant skill.
Persistence & Privilege
always is false and the skill does not request to modify other skills or system-wide settings. Autonomous invocation is allowed (platform default) but there are no additional privileges requested.
Assessment
This skill is instruction-only and appears coherent for giving responsive-layout advice. Before enabling: (1) Note that if you ask it to debug your project, the agent may read any code or snippets you paste—avoid sharing secrets or private keys. (2) Verify outputs (CSS snippets) before applying them to production code. (3) If you need offline or private review, prefer pasting minimal, non-sensitive examples rather than full project files.

Like a lobster shell, security has layers — review code before you run it.

latestvk975rxcr0w6vpvngtsqx9ypenn856vse
128downloads
0stars
1versions
Updated 1w ago
v1.0.0
MIT-0

响应式与布局(Responsive Layout)

帮助设计断点、Flex/Grid 布局、移动端适配与单位选择(rem/vw 等)。

触发场景

  • 用户说「响应式」「布局」「移动端适配」「flex」「grid」「断点」「rem」「vw」
  • 需求:多端一致体验、不同分辨率、横竖屏、安全区

分析维度

1. 断点与策略

策略适用
移动优先先写小屏样式,再 min-width 放大;利于性能与渐进增强
桌面优先先写大屏,再 max-width 缩小; legacy 项目常见
常用断点如 640/768/1024/1280(Tailwind 系)或 375/768/1024/1440,按设计稿统一

2. 布局方式

方式适用
Flex一维、对齐、均分、换行;导航、卡片行、表单项
Grid二维、行列同时控制;列表、仪表盘、卡片网格
混合外层 Grid 分栏,内层 Flex 对齐;避免过度嵌套

3. 单位与缩放

单位建议
rem字体、间距,便于整体缩放(根字体 62.5% 或 16px)
em组件内相对父字体
vw/vh全屏块、大标题;注意小屏溢出与安全区
%容器内比例;配合 flex/grid 更稳
避免整站用 px 不利于无障碍缩放;必要时仅用于 1px 边框等

4. 移动端与安全区

要点做法
视口viewport meta、禁止缩放时仍考虑字体缩放
安全区safe-area-inset 适配刘海/底部横条
触控点击区域不小于 44×44;留足间距防误触
横竖屏关键布局用 orientation 或宽高比媒体查询

执行流程

1. 先判断用户的实际问题

用户描述实际需求第一步
「响应式怎么做」「移动端适配」从零设计布局方案问:设计稿是移动优先还是桌面优先?主要断点是什么?用 Tailwind 还是原生 CSS?
「这个布局在手机上乱了」具体布局 bug直接看代码,找问题,不要先讲理论
「flex 还是 grid」布局方式选择问:是一维排列(导航、卡片行)还是二维网格(仪表盘、图片墙)?
「rem 怎么用」「vw 怎么用」单位选择直接给出该场景的推荐和代码示例
「安全区怎么适配」刘海屏/底部横条直接给代码:padding: env(safe-area-inset-bottom)

2. 从零设计布局时,按这个顺序推进

第一步:确认设计稿信息(没有就问)

  • 设计稿宽度(375/390/1440?)
  • 主要断点(设计稿给了几个尺寸?)
  • 是否有移动端和桌面端两套设计

第二步:给出布局方案,不要只给原则

直接给骨架代码:

/* 移动优先示例 */
.container {
  width: 100%;
  padding: 0 16px;
}

@media (min-width: 768px) {
  .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
  }
}

第三步:flex vs grid 的判断规则

  • 导航栏、按钮组、卡片行(一维,主轴方向排列)→ Flex
  • 仪表盘、图片墙、表单网格(二维,行列同时控制)→ Grid
  • 不确定时:先用 Flex,需要二维控制时再换 Grid

3. 单位选择的明确建议

不要给「看情况」的答案,直接给推荐:

  • 字体大小rem(基于根字体,支持用户缩放偏好)
  • 组件内间距(padding/margin):rem 或 Tailwind 的间距类
  • 全屏高度100dvh(比 100vh 更准确,处理了移动端地址栏)
  • 响应式字体clamp(1rem, 2.5vw, 1.5rem)(在最小值和最大值之间流式缩放)
  • 1px 边框px(不需要缩放)
  • 避免:整站用 px 做字体和间距(不支持用户缩放偏好)

4. 常见问题的直接解法

遇到这些问题,直接给代码,不要先问:

移动端点击区域太小

.btn { min-height: 44px; min-width: 44px; }

iOS 底部安全区

.footer { padding-bottom: env(safe-area-inset-bottom); }

图片在不同尺寸下不变形

img { width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; }

文字在小屏溢出

.text { overflow-wrap: break-word; word-break: break-word; }

输出模板

## 响应式布局方案

### 断点与策略
- 策略:移动优先 / 桌面优先
- 断点:…(与设计稿对应)

### 布局结构
- 整体:Grid / Flex …
- 关键区块:…

### 单位与缩放
- 字体/间距:rem 基准 …
- 特殊:vw/vh 使用处与注意

### 移动端与安全区
- 安全区:…
- 触控/横竖屏:…

项目相关

  • CSS 变量:断点、间距、字号可做成变量,便于主题与维护
  • Tailwind:用默认断点或 tailwind.config 扩展;避免任意值过多
  • 组件库:覆盖栅格与间距 token,与设计系统一致

Comments

Loading comments...