簡體   English   中英

HTML5結構和章節或文章中的標題

[英]HTML5 structure and headings in section or article

雖然我真的應該知道這一點,但我擔心我不能完全理解。 閱讀過不同的文章,閱讀書籍並與其他人交談后,我仍然不太了解HTML5 section的正確結構。 在每個section和/或article都有一個h1標簽是否合適? 新的sectionarticle是否構成了再次啟動h1h2過程?

我的印象是每個“塊”應該被允許它自己的“標題”結構。

例如,這是正確的HTML5嗎?

<!doctype html>
<html>
  <head>
    <title>
    <!-- etc. etc. -->

    <body>
      <section> <!-- two or more <articles> within this section, both using <h1> tags -->
        <h1>Here is a section with articles in</h1>
        <article>
          <h1>Heading</h1>
          <h2>sub heading</h2>
          <p>A paragraph>
        </article>
        <article>
          <h1>Heading</h1>
          <h2>sub heading</h2>
          <p>A paragraph</p>
        </article>
        ...      
      </section>
      <section> <!-- two or more <articles> within this additional section, both using <h1> tags -->
        <h1>Here is a section with articles in</h1>
        <article>
          <h1>Heading</h1>
          <h2>sub heading</h2>
          <p>A paragraph>
        </article>
        <article>
          <h1>Heading</h1>
          <h2>sub heading</h2>
          <p>A paragraph</p>
        </article>
        ...      
      </section>                  
    </body>
</html>

由於每對h1h2在你的元素article小號分別代表一個標題和副標題,你需要組對到自己的header的內article ,以產生每篇文章一個適當的文檔大綱。

除此之外,您的部分的標題結構似乎很好。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM