【发布时间】:2014-10-20 20:33:59
【问题描述】:
我正在将我的一个旧网站更新为 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, subtitle=h2, and article title=h1?
哦,我差点忘了网站标题也是用 h1 标签包裹的。
编辑:
所以我添加了一些 HTML 注释来澄清它。
我希望现在很清楚文章是最重要的内容,第二个是Sub title,Section Main title 只是一个组名,从 seo 的角度来看可能完全无关,但它在我不知道的原始设计中不想改变。
【问题讨论】:
-
看起来很简单。 H1 最重要,H6 最不重要。根据需要设置样式。
-
好的,所以如果我按照我写的那样做 h3 > h2 > h1 顺序从 seo 的角度来看不会是错误的吗?
-
章节主标题应该是h1,副标题应该是h2,文章标题应该是h3(或者只是标题)
-
完全不清楚页面的实际结构是什么,“重要性”是什么意思,“正确”是什么意思。此外,依赖“HTML5 大纲”(这就是代码似乎正在做的事情)是没有意义的。
-
@Jukka K. Korpela 这是实际的结构,只是去掉了与这个问题无关的代码。在重要性方面,我的意思是它对它自己的网站很重要,对 seo 也很重要。我会将 html cmets 中的实际内容和 cmets 放入我上面的代码中,以使其更清晰,直到我在
superUntitled's的评论中写了一个示例@答案
标签: html