link-in-text-block
它能做什么
这项技能检查正文中的链接,并确保它们在视觉上清晰可辨,通常通过下划线实现。适用于关注无障碍设计的设计师和前端开发者。
适用场景
- ✓当你请智能体检查文章或段落中链接样式的时候。
- ✓当设计去掉了链接的下划线,而你想确认它们是否仍然容易看清的时候。
- ✓当你为无障碍审查准备页面,需要确认链接不是仅靠颜色来区分的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/link-in-text-block/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我检查博客文章中的链接,看它们是否能和其他文字轻松区分。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会查看正文文本块中的链接样式,检查是否有下划线,或者颜色对比度是否足够。然后它会报告可能被忽略的链接,并建议修改方法。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Make links in text blocks visually distinguishable
Approximately 8% of men and 0.5% of women have color vision deficiency (red-green being most common). If links are distinguished only by a color like blue or red, these users may not identify them as links and miss critical navigation or reference information. The underline is a universal, color-independent signal understood across cultures and vision abilities. Removing underlines is a common design trend that disproportionately affects users with low vision and cognitive disabilities.
Quick Reference
- Color must not be the only visual means of distinguishing links from surrounding text — WCAG 2.1 SC 1.4.1 (Use of Color)
- Option 1: Underline links (the browser default and most robust approach)
- Option 2: If no underline, the link color must have ≥ 3:1 contrast ratio against surrounding body text AND ≥ 4.5:1 against the background
- Focus and hover states must also maintain distinguishability
- Applies only to links embedded within paragraphs/text blocks; standalone navigation links have different requirements
Check
Find all <a> elements within text-heavy containers (paragraphs, article body, list items containing prose). Check the CSS applied: if text-decoration: none or text-decoration: underline is removed, verify that the link color has at least 3:1 contrast ratio against the surrounding non-link text color AND at least 4.5:1 against the background. Also check :hover and :focus states for a non-color visual change (underline appearing, outline, background change).
Fix
The simplest fix is to restore text-decoration: underline on inline text links within body copy — this is the most widely understood and color-independent link indicator. If the design requires no underline: calculate the contrast between link color and body text color using the WCAG relative luminance formula; it must be ≥ 3:1. Add a non-color visual change on :hover and :focus (e.g., underline appears, font-weight changes, or background-color is added).
Explain
WCAG 2.1 SC 1.4.1 (Use of Color, Level A) states that color must not be the sole visual means of conveying information, indicating an action, prompting a response, or distinguishing a visual element. For links within text, this means a user who cannot perceive the link color must still be able to identify the link. The WCAG technique G183 specifies that a 3:1 contrast ratio between link and surrounding text, combined with a non-color hover/focus cue, is a sufficient technique. The browser default underline satisfies SC 1.4.1 on its own.
Code Review
Review the rendered markup and interactive states that affect Make links in text blocks visually distinguishable. Flag exact elements, roles, labels, focus behavior, or keyboard interactions that violate the rule, and note how to verify the fix with browser accessibility tooling or assistive tech.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/accessibility/link-in-text-block
常见问题
为什么链接需要下划线?
有些人无法分辨某些颜色,因此下划线能清楚地表明这段文字是链接。
这也适用于菜单链接吗?
不适用。这项技能针对段落中的链接,而不是导航菜单或按钮样式的链接。
我可以去掉下划线吗?
只有当链接颜色与周围文字和背景之间有足够的对比度时,这项技能才允许去掉下划线。
详情
作者的原始描述
Use when applies to hyperlinks (`<a>` elements) that appear inline within paragraphs or text blocks. Does not apply to navigation menus, button-style links, or standalone links that are visually isolated from body text. Use when reviewing CSS that removes text-decoration from inline body copy links.
热度
- GitHub 星标
- 75k
- 排名
- #2921
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。