How to correctly use the section tag in HTML5?

Spread the love

Sometimes, we want to correctly use the section tag in HTML5.

In this article, we’ll look at how to correctly use the section tag in HTML5.

How to correctly use the section tag in HTML5?

To correctly use the section tag in HTML5, we can use it with article elements or other section elements.

For instance, we write

<section id="main">
  <article>
    <!-- first blog post -->
  </article>

  <article>
    <!-- second blog post  -->
  </article>

  <article>
    <!-- third blog post -->
  </article>
</section>

to add the article elements in the section element.

Or we write

<article>
  <section id="introduction"></section>

  <section id="content"></section>

  <section id="summary"></section>
</article>

to nest section elements in a section element.

Conclusion

To correctly use the section tag in HTML5, we can use it with article elements or other section elements.

Leave a Reply

Your email address will not be published. Required fields are marked *