官术网_书友最值得收藏!

The <section> element

As per the MDN definition:

The HTML Section Element (<section>) represents a generic section of a document, i.e., a thematic grouping of content, typically with a heading. Each <section> should be identified, typically by including a heading (<h1>-<h6> element) as a child of the <section> element.

Here are a few important points to remember about the <section> element:

  • The <section> element can be used to encapsulate a group of related content. This related content doesn't necessarily have to make sense if we take it out of the page's context.
  • A safe and valid way to use the <section> element is to place it inside an <article> element. You can certainly use the <article> element without a <section> element. It's recommended, although not required, to include a heading element (<h1>, <h2>, <h3>, and so on) when using the <section> element.
  • It can be confusing to know when to use the <section> element and when to use the <article> element. If you're in doubt, you can choose either element.
  • There can be more than one <section> in a single page.

Consider the following example:

<body>
   <main class="main-container" role="main">
      <article class="article-container flex-container">
         <section class="main-content">
            <header>
               <h1>The <code>&lt;main></code> element </h1>
            </header>
            <p>As per the MDN definition:</p>            <blockquote>
 <p>The HTML Main Element (<code>&lt;main></code>)                      represents&hellip;</p>
            </blockquote>
         </section>
      </article>
   </main>
</body>
主站蜘蛛池模板: 渭南市| 元朗区| 肇庆市| 宜君县| 郎溪县| 纳雍县| 油尖旺区| 麻阳| 沧州市| 伊金霍洛旗| 方正县| 新安县| 石城县| 资阳市| 莱芜市| 绍兴市| 克什克腾旗| 和顺县| 福贡县| 兴文县| 绥江县| 武城县| 镶黄旗| 洱源县| 安化县| 鸡西市| 正宁县| 鄂州市| 连江县| 遵义市| 包头市| 宾阳县| 保靖县| 区。| 禹城市| 韶山市| 清水县| 灯塔市| 改则县| 宁夏| 天祝|