Interview Question

What is the use of figure and figcaption?

figure groups an item; figcaption describes it.

💡 Concept ✅ Quick Revision 🌐 HTML

Answer

`<figure>` groups self-contained content and `<figcaption>` gives it a caption. • They work well for images, diagrams, code, or charts. • The caption explains the grouped item. • The figure may be moved without changing the main sentence flow.

💡 Simple Example

<figure><img src="planet.jpg" alt="Mars"><figcaption>Mars, the red planet.</figcaption></figure>

⚡ Quick Revision

figure groups an item; figcaption describes it.