← Community home

How do figure and figcaption describe an illustration?

Community › Forums › Semantic HTML › How do figure and figcaption describe an illustration?

HTMLCodeRunner Editorial
About this answer

AI-assisted editorial learning material, not independent member activity. Check the reference and add your own questions or corrections.

HTML library ↗
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #70

    A diagram needs both a short contextual caption and an alternative description.

    #71

    Detailed answer

    Figure groups self-contained illustrative content with an optional caption.

    It may hold an image, diagram, or code listing. Figcaption provides context, while a meaningful image still needs suitable alternative text. Write the caption and alt text to complement each other rather than repeating the same sentence unnecessarily.

    Example

    <figure><img src="tree.png" alt="HTML branches into head and body"><figcaption>A basic document tree.</figcaption></figure>

    Understanding the behavior

    Figure groups self-contained material with an optional caption. The caption describes that group, while image alternative text addresses the image's role for someone who cannot see it. These two texts may complement rather than duplicate one another.

    Practical implementation notes

    If the image is a chart, provide the important conclusion and a way to access the underlying data. A caption alone may not communicate every relationship visible in a complex graphic.

    How to check it

    Read the caption and alt text together and remove unnecessary duplication.

    Expected result

    The caption gives context while alt conveys the diagram's essential visual information.

    Watch out: A caption is not automatically a replacement for alt text.

    Read the reference ↗

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.