topskill.dev
CoursesTracks
0
All courses/Introduction to HTMLDetails, Figure, and Figcaption
Semantic HTML
2 / 4
← Introduction to HTML
○What Is HTML? See Tags in Action○Build the Meridian Signal○Complete HTML5 Page Structure○Build a Complete HTML5 Page✦Module Quiz
○Heading Hierarchy: H1 and H2○Extend the Signal Brief○Paragraphs and Inline Tags○Write Meridian's Survey Notes○List Types: Steps, Items, and Terms○Build a Crew Member Loadout○Challenge: Transmit a Rescue Signal✦Module Quiz
○Hyperlinks○Links between project files○Images○Applying Styles to HTML✦Module Quiz
○Div and Span○HTML Tables○Classes and IDs○Review: Structured Profile✦Module Quiz
○Project 1 - Visiting Card Structure○Project 1 - Visiting Card Actions✦Module Quiz
○The Head Element and Page Title○Meta Tags○HTML Entities✦Module Quiz
○Form Basics: Join the Meridian Relay○Build a Night-Shift Check-In○Input Types: Build a Mission Profile○Record Beacon Maintenance○Choice Controls: Select Training Modes○Plan a Supply Pickup○Response Controls: Send a Mission Reply○Build a Rescue Dispatch Report○Form validation and submission○Challenge: Send an Emergency Beacon✦Module Quiz
○Project 2 - Contact Us Form Structure○Project 2 - Contact Us Form Actions✦Module Quiz
○Embedding Video○Embedding Audio○Iframes✦Module Quiz
○Semantic HTML Tags●Details, Figure, and Figcaption○A keyboard-friendly page✦Module Quiz
○Project 3 - Resume Semantic Structure○Project 3 - Resume Links and Actions✦Module Quiz

Details, Figure, and Figcaption

The garden's visitor page needs two short answers and a captioned seedling illustration. Use native HTML to let visitors open the answers and keep the image's caption attached to it.

Make an answer expandable

A <details> element hides optional content until the visitor opens it. Put a <summary> first: it becomes the control that a visitor can click or reach with the keyboard.

Here is a separate repair-cafe example:

html
<details>
  <summary>Should I bring spare parts?</summary>
  <p>Bring any parts you already have. Volunteers will help identify what is missing.</p>
</details>

Add the boolean open attribute to show an answer initially. open="false" still means open because the attribute is present; remove the attribute to start closed. Separate details elements can stay open at the same time.

Attach a caption to media

A <figure> groups a self-contained image, diagram, or other item with its caption. Place <figcaption> directly inside the figure, as its first or last element:

html
<figure>
  <img src="repair-table.jpg" alt="Volunteer examining the wiring inside a desk lamp">
  <figcaption>A lamp repair at the neighborhood repair cafe.</figcaption>
</figure>

The filename above is illustrative. A caption gives visible context; alt supplies an image's text alternative. They serve different purposes, so do not omit the alt text just because a caption exists.

Use the supplied illustration

The starter includes a small seedling image with a working data URL. A data URL contains the image itself, so it needs no external download. Leave its long src unchanged. You will move that image into a figure and replace its empty alt with a description. This supplied image is not a completed task.

Your Task

  1. Add two separate <details> elements, each containing a paragraph that answers a question about visiting the garden.
  2. Add a nonempty <summary> as the first element inside each details element.
  3. Add open to exactly one details element so only that answer starts expanded.
  4. Move the supplied image into a <figure> and give it alt text describing the seedlings.
  5. Add a nonempty <figcaption> directly inside that figure, before or after the image.

Edit index.html, Run, then Submit. Open and close each answer with its summary. Try Tab followed by Enter or Space on a summary too. Check that the seedling illustration and its visible caption read as one unit. The automated checks cover markup relationships; this keyboard check is your separate interaction check.

Hint 1
1 / 4
HINT 1

The <details> element is collapsed by default. Add the open attribute to expand it on load.

HINT 2

The first child of <details> should be a <summary> — it becomes the clickable toggle text.

HINT 3
<figure> is for self-contained media (image, diagram, code) referenced from the main text.
HINT 4
<figcaption> provides a caption for a <figure> and can be placed at the top or bottom.
Files
  • ⋄index.html
Loading editor…