正确使用<标题>标记在HTML5中 [英] Right usage of the <header> tag in HTML5
问题描述
我读过标签是一个部分的标题。它可以在文档中使用多次。
我是否应该使用< header>
标签部分:
< section>
< header>
< / header>
< / section>
或高于<小节>
类似:
< header>
< / header>
<节>
< / section>
是否有这样的标题信息和部分结构:
< section id =main>
< header id =results>
< h1>我的结果< / h1>
< / header>
< section id =results>
< section id =result1>
< h2>标题< / h2>
< div class =body>< / div>
< / section>
< section id =result2>
< h2>标题< / h2>
< div class =body>< / div>
< / section>
。
。
。
< / section>
< / section>
你这个例子是否适合语义的使用哦HTML5标签的header和section? / p>
或者我应该使用< section id =main>
来代替< main>
tag?
p>
这里部分
有一个头
:
< section>
< header>
< / header>
< / section>
这里父母部分(*)有一个头
和一个子<头
):
< header>
< / header>
<节>
< / section>
(*可能是像文章
/ 部分
/ nav
/ 旁边
,或分段例如 body
/ etc。)
这两种情况都是可能的,这取决于您的内容的含义。 / p>
请参阅我的回答以了解相关问题,其中包含一个示例具有不同标题
元素的文档。
I have read that the tag is the header of a section. It could be used more then 1 time in the document.
Should I use the <header>
tag in the section:
<section>
<header>
</header>
</section>
or above the <section>
like:
<header>
</header>
<section>
</section>
Is it possible to have this sctucture for heading information and the sections:
<section id="main">
<header id="results">
<h1>My Results</h1>
</header>
<section id="results">
<section id="result1">
<h2>Title</h2>
<div class="body"></div>
</section>
<section id="result2">
<h2>Title</h2>
<div class="body"></div>
</section>
.
.
.
</section>
</section>
do you thing this example is a good one for semantic usage oh the HTML5 tags header and section?
Or should I use instead of the <section id="main">
, the <main>
tag?
Your two cases have a different meaning:
Here the section
has a header
:
<section>
<header>
</header>
</section>
Here the parent section (*) has a header
and a child section
(which has no header
):
<header>
</header>
<section>
</section>
(* Could be a sectioning element like article
/section
/nav
/aside
, or a sectioning root like body
/etc.)
Both cases are possible, it depends on the meaning of your content.
See my answer to a related question, which contains an example document with different header
elements.
这篇关于正确使用<标题>标记在HTML5中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!