HTML5 HTML5 Semantic Elements 2 — Questions and Answers
Question 1: Which element should be used to mark up a standalone piece of content like a photo with a caption?
- <figure> (Correct answer)
- <img>
- <picture>
- <media>
Correct answer: <figure>
The <figure> element wraps self-contained content like images or diagrams, often accompanied by a <figcaption>.
Question 2: What is the <figcaption> element used for?
- Providing a caption for a <figure> element (Correct answer)
- Styling images inline
- Adding alt text to images
- Creating image tooltips
Correct answer: Providing a caption for a <figure> element
The <figcaption> element defines a caption or legend for its parent <figure> element.
Question 3: Which HTML5 element is used to display a disclosure widget from which users can retrieve additional information?
- <details> (Correct answer)
- <summary>
- <dialog>
- <accordion>
Correct answer: <details>
The <details> element creates a native disclosure widget that can be toggled open or closed to show additional content.
Question 4: The <summary> element must be placed inside which HTML5 element?
- <details> (Correct answer)
- <figure>
- <section>
- <article>
Correct answer: <details>
The <summary> element provides a visible heading for a <details> element and is always a direct child of <details>.
Question 5: Which element in HTML5 represents the result of a calculation, such as one performed by a script?
- <output> (Correct answer)
- <result>
- <calc>
- <data>
Correct answer: <output>
The <output> element represents the result of a calculation or user action, often used with form elements.
Question 6: What is the purpose of the <mark> element in HTML5?
- Highlights text for reference purposes (Correct answer)
- Bolds important text
- Creates a bookmark anchor
- Marks deprecated content
Correct answer: Highlights text for reference purposes
The <mark> element represents text highlighted for reference or notation purposes, typically rendered with a yellow background.
Which element should be used to mark up a standalone piece of content like a photo with a caption?