如果子元素比父元素更重要,如何正确使用H标记

时间:2014-10-20 01:05:07

标签: html html5

我将我的旧网站之一更新为html5,即使在阅读了大量文章后,我也有点困惑,如何正确使用h标签。

正如标题所说,孩子们比父母更重要,所以在我的示例代码中,最重要的是文章标题而不是子标题,最不重要的是部分主标题。

<html>
<head>
<!-- head stuff here-->
</head>
<body>
<header>
<!-- site name and logo and sitenav is here -->
</header>
<div id="section1">
  <div class="this_should_be_h_tag">
  Section 1 Main title
  <!-- for example this section is Called MENU (like restaurant menu) -->
  </div>
  <div id="section1_1">
    <div class="this_should_be_h_tag">
    Sub title 1
    <!-- for example this sub section is called HAMBURGERS -->
    </div>
    <article>
      <header>
        <h1>
        Article title
        <!-- lets say this is called BBQ Burger -->
        </h1>
      </header>
      <div class="article-body">
      <!-- here is the description of the BBQ Burger -->
      </div>
      <footer></footer>
    </article>
    <article>
      <header>
        <h1>
        Article title
        <!-- lets say this is called Vega Burger -->
        </h1>
      </header>
      <div class="article-body">
      <!-- here is the description of the Vega Burger -->
      </div>
      <footer></footer>
    </article>
  </div>

  <div id="section1_2">
    <div class="this_should_be_h_tag">
    Sub title 2
    <!-- for example this sub section is called SPECIALITIES -->
    </div>
    <article>
      <header>
        <h1>
        Article title
        <!-- lets say this is called Jalapeno Poppers -->
        </h1>
      </header>
      <div class="article-body">
      <!-- here is the description of the Jalapeno Poppers -->
      </div>
      <footer></footer>
    </article>
    <article>
      <header>
        <h1>
        Article title
        <!-- lets say this is called Duckets -->
        </h1>
      </header>
      <div class="article-body">
      <!-- here is the description of the Duckets -->
      </div>
      <footer></footer>
    </article>
  </div>
</div>
<footer>
<!-- footer stuff here -->
</footer>
</body>
</html>

所以在这样的结构中,正确的路径是什么?我可以这样做:section main title = h3,sub title = h2,article title = h1?

哦,我差点忘了网站标题也包含在h1标签中。

编辑: 所以我添加了一些HTML注释来稍微强化它。 我希望现在很清楚,这些文章是最重要的内容,第二个是Sub title,而Section Main title只是一个群组名称,从seo的角度来看可能完全无关,但它在原文中我不想改变的设计。

1 个答案:

答案 0 :(得分:0)

第1节主要应该是您的h1。字幕应为h2。文章标题h3

搜索引擎会正确索引您的网站。只需确保您的章节和子章节标题有意义。

相关问题