Understanding the use of the tag <section>

Hallo, I’m studying html for the first time in Codecademy and I have a doubt about the section tag. Why in this exercise figure tag isn’t encapsulated in section? https://www.codecademy.com/courses/learn-html/lessons/semantic-html/exercises/figure-and-figcaption?action=resume_content_item

Hello, @giga3157278301. Welcome to the forum. The use of the <section></section> tag is to help us as developers group our content according to relevancy. These lessons are just showing off the various semantic tags, and their usefulness, so if it makes sense to you to encapsulate the <figure></figure> tag in a <section></section> tag that would be perfectly fine. You may even want to use it, so you could apply styling like possibly a background color to the section containing the <figure><img><figurecaption></figurecaption></figure>. It seems in the lesson, they just wanted to show that by placing the <img> inside the <figure></figure> tag we could easily caption the image with the <figcaption></figcaption> tag.

1 Like