1.

What is the difference between article vs section? Provide usage examples.

Answer»

<SECTION> is best used as a sub-section of an <article> and should always contain and enclose a heading, something like the following:

  • Don’t use <section> as a target for styling or SCRIPTING; use a <div> for that
  • Don’t use <section> if <article>, <aside>, or <nav> is more appropriate.
  • Don’t use <section> unless there is NATURALLY a heading at the start of the section.
<article> <h1>A heading, any level from h1 to h6</h1> <section>   <h1>A heading, any level from h1 to h6</h1>some content </section> <section> <h1>A heading, any level from h1 to h6</h1>some content </section>  </article> 

An <article> is a stand-alone ITEM, such as a self-contained piece of information that could be LIFTED from the page and published in a forum, magazine, RSS feed, or newspaper. It should contain and enclose a heading (h1 to h6) and it can contain two or more sections. The key words are STAND ALONE.



Discussion

No Comment Found