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

html5-semantic-elements

它能做什么

这项技能检查页面是否使用了 header、main、nav 和 footer 等 HTML5 结构元素。适用于构建页面布局和模板的开发者。

适用场景

  • ✓当页面主要由通用的 div 元素构成的时候。
  • ✓当屏幕阅读器用户无法直接跳到主要内容的时候。
  • ✓当你在构建新的页面模板或布局组件的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/html5-semantic-elements/SKILL.md

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

使用方法

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

可直接粘贴的消息

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

可以这样问 AI

“请帮我更新页面布局,使用正确的 HTML5 结构元素。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会审查标记,并建议用能描述其作用的元素替换通用容器。它还会检查每个页面是否只有一个 main 元素。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Use semantic HTML elements

Screen readers use semantic elements to navigate pages—users can jump directly to <main> content or <nav>. Search engines also use semantics to understand content hierarchy.

Quick Reference

  • Use <header>, <main>, <footer> for page structure
  • Use <article> for self-contained content, <section> for grouped content
  • Use <nav> for navigation, <aside> for related/sidebar content
  • Only one <main> per page, but multiple <header>/<footer> allowed

Check

Review this HTML structure to ensure it uses appropriate semantic elements like header, main, section, article, aside, and footer instead of generic div elements.

Fix

Replace generic div elements with semantic HTML5 elements that accurately describe the content structure and purpose.

Explain

Explain how semantic HTML elements improve accessibility, SEO, and code maintainability by providing meaningful structure to web content.

Code Review

Review templates, server-rendered HTML, and shared components that output markup related to Use semantic HTML elements. 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.

Rule page: https://frontendchecklist.io/rules/html/html5-semantic-elements

常见问题

建议使用哪些元素?

这项技能建议使用 header、main、footer、article、section、nav 和 aside,每个元素各有其用途。

一个页面可以有多个 header 吗?

可以。这项技能指出,允许使用多个 header 和 footer 元素,但每个页面只能有一个 main。

它对搜索有什么影响?

这项技能指出,搜索引擎会利用语义化元素来理解内容的层级结构。

详情

作者的原始描述

Use when reviewing templates, rendered HTML, or shared components related to Use semantic HTML elements. Validate the final browser-facing markup, not just the source framework abstraction.

repo: thedaviddias/Front-End-Checklist

热度

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能