Home > database >  How to use article and section tags in the best way?
How to use article and section tags in the best way?

Time:08-07

I got confused about section and article tags.I can't choose which one to use sometimes.for example if I want to make shopping website.is it ok that I use a section tag and then put article tags in it for product card?like this:

enter code here

 <section >
     <h2>Phones</h2>
     <article ></article>
 </section>

CodePudding user response:

I think the way you use <section> and <article> is perfectly reasonable!

<section>

  • It is a generic standalone section.
  • Should always have a heading, which you do.

section: MDN

<article> A product card is one of the examples MDN mentions for <article>

article: MDN

  • Related