跳到正文
Skillpedia
网站与界面(前端)75k · #2718

alt-text

它能做什么

这项技能检查页面上的每张图片是否都有描述其用途的替代文字。适合希望让屏幕阅读器用户和搜索引擎都能理解图片的网页团队。

适用场景

  • ✓当你在网页或模板中添加图片时。
  • ✓当图片的替代文字是文件名,或完全没有替代文字时。
  • ✓当你在审查页面的基础无障碍性时。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/alt-text/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/alt-text/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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 an alt attribute—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.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#2718
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能