viewport
它能做什么
这个技能检查页面是否有移动端布局所需的视口 meta 标签。它面向构建响应式网站的开发者。
适用场景
- ✓页面在手机上显示得很小,必须放大才能阅读的时候。
- ✓新模板缺少视口 meta 标签的时候。
- ✓审查输出页面 head 标记的共享组件的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/viewport/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“在我的手机上,我的网站看起来像一个很小的桌面页面。需要什么标签才能修复它?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会检查 head 部分是否有视口标签,如果缺少就添加它。它还会确保没有任何设置阻止缩放。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Set the responsive viewport meta tag
Without the viewport meta tag, mobile browsers render pages at desktop width (typically 980px) then shrink them, making text unreadable without zooming.
Quick Reference
- Add
<meta name="viewport" content="width=device-width, initial-scale=1.0"> - Never use
maximum-scale=1oruser-scalable=no(breaks accessibility) - Essential for mobile-responsive layouts
Check
Verify that this HTML document includes a proper viewport meta tag for responsive design that controls how the page is displayed on mobile devices.
Fix
Add the viewport meta tag: <meta name="viewport" content="width=device-width, initial-scale=1.0"> in the head section.
Explain
Explain how the viewport meta tag enables responsive design and why it's essential for mobile-first web development.
Code Review
Review templates, server-rendered HTML, and shared components that output markup related to Set the responsive viewport meta tag. Flag exact elements, attributes, and routes where the rendered HTML violates the rule.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
常见问题
视口标签有什么作用?
它告诉移动端浏览器使用设备宽度,而不是以宽大的桌面宽度渲染页面再缩小。
应该避免哪些设置?
这个技能说,不要使用 maximum-scale=1 或 user-scalable=no,因为它们会破坏无障碍性。
响应式设计需要这个吗?
需要。这个技能称它是移动端响应式布局的必要条件。
详情
作者的原始描述
Use when reviewing templates, rendered HTML, or shared components related to Set the responsive viewport meta tag. Validate the final browser-facing markup, not just the source framework abstraction.
热度
- GitHub 星标
- 75k
- 排名
- #3079
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。