alt-text
它能做什么
这项技能检查页面上的每张图片是否都有描述其用途的替代文字。适合希望让屏幕阅读器用户和搜索引擎都能理解图片的网页团队。
适用场景
- ✓当你在网页或模板中添加图片时。
- ✓当图片的替代文字是文件名,或完全没有替代文字时。
- ✓当你在审查页面的基础无障碍性时。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/alt-text/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请检查我首页上的每张图片,在缺少或含糊的地方改写更好的替代文字。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会扫描每个图片元素,标出缺失或通用的 alt 值,并根据每张图片在页面中的含义编写描述。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Provide meaningful alt text for images
Approximately 2.2 billion people worldwide have vision impairment. Screen readers read the alt attribute aloud—without meaningful alt text, users who are blind receive no information about image content. Missing alt text also fails WCAG 2.1 Success Criterion 1.1.1, which is a Level A (minimum) requirement. Search engines also rely on alt text to index image content.
Quick Reference
- Every
<img>must have analtattribute—omitting it entirely violates WCAG 2.1 SC 1.1.1 - Decorative images use
alt=""so screen readers ignore them - Alt text should describe the image's purpose, not just its appearance
- Linked images: alt describes the link destination, not the visual
Check
Scan all <img> elements in the codebase. Verify: 1) Every <img> has an alt attribute (missing alt is an error). 2) Decorative images use alt="". 3) Informative images have descriptive text that conveys the image's meaning—not just its file name. 4) Images that are links describe the destination. 5) Images of text reproduce the text in alt. Flag any <img> without alt, with alt matching the filename (e.g., alt="photo1.jpg"), or with generic values like alt="image" or alt="photo".
Fix
For each image missing or with poor alt text: 1) Informative images—describe what the image conveys, not just what it shows (e.g., alt="Bar chart showing 40% increase in sales Q3 2024" not alt="chart"). 2) Decorative images—add alt="" so screen readers skip them. 3) Linked images—describe the link destination (e.g., alt="Visit our Twitter profile"). 4) Images of text—copy the text verbatim into alt. 5) Complex images (charts, infographics)—provide a short alt plus a longer description via aria-describedby or a visible caption.
Explain
Explain WCAG 2.1 Success Criterion 1.1.1 Non-text Content: every image must have a text alternative. Screen readers announce the alt attribute aloud—without it, users who are blind or have low vision cannot understand the page. Bad alt text (like alt="image") is no better than no alt text. Decorative images must use alt="" explicitly so screen readers skip them entirely—omitting alt causes some screen readers to announce the filename.
Code Review
Review image assets, markup, and delivery configuration related to Provide meaningful alt text for images. Flag exact files or components where format choice, sizing, or loading behavior violates the rule, and describe how to confirm the fix in DevTools.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/images/alt-text
常见问题
装饰性图片需要替代文字吗?
不需要。这项技能说明,装饰性图片应使用空的 alt 值,以便屏幕阅读器跳过它们。
替代文字为什么对搜索重要?
这项技能说明,搜索引擎也会使用替代文字来理解图片内容。
像 photo1.jpg 这样的替代文字有什么问题?
它只写了文件名,而没有说明图片的含义,因此对屏幕阅读器用户没有帮助。
详情
作者的原始描述
Use when reviewing image assets, markup, and CDN or build transforms related to Provide meaningful alt text for images. Check encoded size, rendered size, loading strategy, and above-the-fold impact together.
热度
- GitHub 星标
- 75k
- 排名
- #2718
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。