1

Hi im just trynna figure out whether or not i should use article or section. Just to give a bit of context, this part of my code comes from the index file (it is the home page of my website). I am coding a website about HTML for beginners . I used one article with 4 sections inside . Basically to give some context, this part of my website very briefly explains to new learners what html is in 4 different sections. please tell me if this is semantical correct. thank you all


  <main>
    <article>
      <header>
        <h2>What is HTML?<h2>
      </header>
      <section>
        <header>
          <h3>Markup Language</h3>
        </header>
          <p>A markup language is a computer language that uses tags to define elements within a document.
            It is human-readable, meaning markup files contain standard words, rather than typical programming syntax.
            While several markup languages exist, the two most popular are <strong>HTML</strong> and <a href="https://www.w3schools.com/xml/xml_whatis.asp" target="_blank">XML</a>
          </p>
      </section>
      <section>
        <header>
          <h3>App & Web development</h3>
        </header>
          <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent vulputate nisl arcu, eget auctor lorem sagittis nec.
            Proin a gravida libero. Interdum et malesuada fames ac ante ipsum primis in faucibus.
            Sed quam erat, interdum ut rutrum euismod, dictum in libero.</p>
      </section>
      <section>
        <header>
          <h3>HTML, CSS & JavaScript</h3>
        </header>
          <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent vulputate nisl arcu, eget auctor lorem sagittis nec.
            Proin a gravida libero. Interdum et malesuada fames ac ante ipsum primis in faucibus.
            Sed quam erat, interdum ut rutrum euismod, dictum in libero.</p>
      </section>
      <section>
        <header>
          <h3>Tags and Attributes</h3>
        </header>
          <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent vulputate nisl arcu, eget auctor lorem sagittis nec.
            Proin a gravida libero. Interdum et malesuada fames ac ante ipsum primis in faucibus.
            Sed quam erat, interdum ut rutrum euismod, dictum in libero.</p>
      </section>
    </article>

1 Answers1

0

As per the standards :-

The article element represents a complete, or self-contained, composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g. in syndication.

So, you are using article correctly by wrapping different sections.

Atul Sharma
  • 9,397
  • 10
  • 38
  • 65