Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)75k · #2843

figure-figcaption

Skill này làm gì

Skill này kiểm tra các chú thích ảnh trên trang có được đánh dấu đúng hay không. Skill dành cho lập trình viên và người biên tập xuất bản nội dung có hình ảnh.

Khi nào nên dùng

  • ✓Khi một ảnh trên trang có chú thích được viết trong một đoạn văn thường.
  • ✓Khi bạn xuất bản bài viết có ảnh, biểu đồ hoặc sơ đồ.
  • ✓Khi chú thích ảnh cần được các công cụ hỗ trợ đọc đúng.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/figure-figcaption/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể sắp xếp các ảnh và chú thích trong bài viết của tôi cho đúng cấu trúc không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent tìm các ảnh có văn bản đặt ngay bên cạnh và bọc từng cặp trong một phần tử figure có figcaption. Agent cũng kiểm tra rằng văn bản thay thế alt không phải là bản sao chính xác của chú thích.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Use <figure> and <figcaption> for image captions

Using a <p> tag as a caption is invisible to assistive technology as an image description. The <figure>/<figcaption> pattern creates a machine-readable relationship between an image and its caption, which screen readers surface to users. It also communicates to search engines that the caption describes the image, supporting image SEO.

Quick Reference

  • Wrap image + visible caption pairs in <figure> with <figcaption> as a direct child
  • <figcaption> must be the first or last child of <figure>
  • Do not duplicate alt text in figcaption—alt is the fallback, figcaption is the visible description
  • <figure> is appropriate for images, code blocks, diagrams, and charts—not every image

Check

Scan the codebase for images with adjacent visible text that acts as a caption (e.g., a <p> or <span> immediately below an <img> describing it). Verify: 1) Such image-caption pairs are wrapped in <figure>. 2) The caption text is inside a <figcaption> element. 3) <figcaption> is a direct child of <figure>. 4) The alt text on the <img> is not identical to the <figcaption> text—they serve different purposes. Flag any <img> followed by descriptive text that is not structured as figure/figcaption.

Fix

For each image with an adjacent caption: 1) Wrap the <img> and its caption text in a <figure> element. 2) Move the caption text into a <figcaption> element inside <figure>. 3) Review the <img> alt attribute—if the figcaption already fully describes the image for sighted users, the alt can be shorter or empty (alt="") only if the figcaption alone is sufficient for screen readers too; otherwise keep a concise alt. 4) Position <figcaption> as the first or last child of <figure>. Show the corrected HTML.

Explain

Explain the semantic meaning of <figure> and <figcaption>. The <figure> element represents self-contained content (an image, code sample, diagram) that is referenced from the main content but could be moved without affecting the document flow. <figcaption> provides a caption or legend for the figure. Screen readers announce the figcaption in association with the figure, giving users context. Without this markup, sighted users see a caption but screen reader users hear only the alt text with no indication that a visible caption exists.

Code Review

Review image assets, markup, and delivery configuration related to Use <figure> and <figcaption> for image captions. 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/figure-figcaption

Câu hỏi thường gặp

figcaption là gì?

Đó là phần tử HTML dành cho chú thích, đặt bên trong phần tử figure cùng với ảnh của nó.

Alt có nên khớp với chú thích không?

Không. Skill nói alt là mô tả thay thế còn chú thích là văn bản hiển thị, nên chúng nên khác nhau.

Mọi ảnh có cần figure không?

Không. Skill nói figure phù hợp với các nội dung như ảnh, khối code, sơ đồ và biểu đồ, không phải mọi bức ảnh.

Chi tiết

Mô tả gốc của tác giả

Use when reviewing image assets, markup, and CDN or build transforms related to Use <figure> and <figcaption> for image captions. Check encoded size, rendered size, loading strategy, and above-the-fold impact together.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

Sao GitHub
75k
Vị trí xếp hạng
#2843
Giấy phép
MIT
Cập nhật
31/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự