viewport-zoom
它能做什么
这个技能检查视口 meta 标签中是否有阻止缩放的设置。它面向希望移动端页面保持无障碍的开发者和模板作者。
适用场景
- ✓页面的视口 meta 标签中包含 user-scalable=no 的时候。
- ✓页面把 maximum-scale 设为 1 或其他很低的值的时候。
- ✓模板或 CSS 框架添加了阻止缩放设置的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/viewport-zoom/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我们的手机网站不允许双指缩放。请帮我检查视口设置吗?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会读取视口 meta 标签,并标出阻止缩放的设置。它会用标准的 width 和 initial-scale 设置替换这些设置。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Do not disable pinch zoom
Pinch-to-zoom is an essential accessibility feature for low-vision users who cannot read text at the page's default size. When zoom is disabled, these users cannot enlarge text or images, making the page completely inaccessible without external magnification software. Low-vision users who rely on browser zoom are entirely blocked. Additionally, all users benefit from being able to zoom in on small text, fine-print, or complex images. Disabling zoom is one of the most harmful and easily preventable accessibility failures.
Quick Reference
- Never use
user-scalable=nooruser-scalable=0in the viewport meta tag - Never set
maximum-scale=1(or any value below 5) in the viewport meta tag - Both prevent pinch-to-zoom, violating WCAG 2.1 SC 1.4.4 (Resize Text, Level AA)
- The correct viewport meta tag is:
<meta name='viewport' content='width=device-width, initial-scale=1'> - Note: iOS 10+ ignores
user-scalable=noin Safari, but other browsers and older iOS do not
Check
Find the <meta name='viewport'> element in the HTML <head>. Check its content attribute for: (1) user-scalable=no — disables all zoom; (2) user-scalable=0 — same effect; (3) maximum-scale=1 or maximum-scale=1.0 — limits zoom to the initial scale; (4) any maximum-scale value below 2 — significantly limits zoom range. Flag any of these. Also check CSS for touch-action: none or user-zoom: fixed (CSS Device Adaptation, rarely used) that may limit zoom.
Fix
Remove user-scalable=no and maximum-scale=1 from the viewport meta tag. The correct viewport meta tag for a responsive site is: <meta name='viewport' content='width=device-width, initial-scale=1'>. If maximum-scale was set for a specific reason (e.g., to prevent unintended zoom on input focus on iOS), the correct fix is to set form input font-size: 1rem (16px) instead — iOS Safari only auto-zooms on input focus when font-size is below 16px.
Explain
WCAG 2.1 SC 1.4.4 (Resize Text, Level AA) requires that text can be resized up to 200% without loss of content or functionality, except for captions and images of text. On mobile devices, pinch-to-zoom and the browser's built-in text size settings are the primary mechanisms for resizing text. Setting user-scalable=no or maximum-scale=1 in the viewport meta tag disables pinch-to-zoom entirely (or limits it to 1x), preventing low-vision users from enlarging content. This is a direct violation of SC 1.4.4. While iOS 10+ Safari ignores these settings, Android browsers, Chrome for iOS, and older iOS versions do not — so the setting must be removed regardless.
Code Review
Review stylesheets, component styles, and responsive states related to Do not disable pinch zoom. Flag exact selectors, declarations, or breakpoints that violate the rule in the rendered UI.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/accessibility/viewport-zoom
常见问题
哪种视口设置是正确的?
这个技能推荐 width=device-width, initial-scale=1。
iPhone 会忽略 user-scalable=no 吗?
这个技能说,iOS 10 及更高版本的 Safari 会忽略它,但其他浏览器和较旧的 iOS 版本仍会遵循它。
缩放与哪项指南有关?
这个技能引用了 WCAG 2.1 成功标准 1.4.4,即调整文字大小。
详情
作者的原始描述
Use when applies to any `<meta name='viewport'>` element in HTML documents. Check the `content` attribute for `user-scalable=no`, `user-scalable=0`, `maximum-scale=1`, or `maximum-scale` values less than 2. This is a common mistake in mobile-first templates and CSS frameworks.
热度
- GitHub 星标
- 75k
- 排名
- #3078
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。