Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML HTML Basics Structuring Your Content Semantic HTML: <header>, <footer> and <section>

"All content lying inside the <body> element is part of a section." - that's what MDN says.

Does it mean that all content between <body> and </body> should be in <section>'s. Because in the next lessons I saw paragraph <p> that is inside the <body> but not part of the any section. Should I put all content in sections all it just a matter of web developer preference?

1 Answer

Abraham Juliot
Abraham Juliot
47,353 Points

Hi Andrei, We can have a page with no <section> tags. Some web developers may consider it a matter of preference, but using the correct tags to markup content has many benefits. Check out this article on the topic:

"By using HTML tags that have meaning, you create pages that impart more information than by just surrounding everything with <div> tags."

Regarding when to use the section element, MDN has some useful info. In short, use the <section> tag if there is not a more specific semantic element to represent the content. For example, if the content is only a paragraph, the <p> tag should directly contain it over a <section> tag.

Thank you for the links in your answer. I have bookmarked them. Thet are very helpful