简体   繁体   English

部分中的标签标题

[英]Tag header within section

Is a good practice put the <header> tag within the <section> one? 好的做法是将<header>标记放在<section>吗? I know it's correct within <header> , <article> , <aside> , <footer> . 我知道在<header><article><aside><footer>

<section> has used to separate different themes of our page and often we might find <article> within that (perhaps with their <header> ). <section>用于分隔页面的不同主题,通常我们可能会在其中找到<article> (也许带有<header> )。 Then my doubt about the correctness of using the <header> tag into the <section> . 然后,我对在<section>中使用<header>标记的正确性表示怀疑。

for eg 例如

<body>
 <header>
  <hgroup>
   <h1>hello</h1>
   <h2>world</h2>
  </hgroup>
 </header>
 <section>
  <header>Total news</header>
  <article>
   <header><h1>News</h1></header>
   <section>
    <header>Daily news</header>
    <article>
     <header><h2>News 1 title</h2></header>
     <p>news 1</p>
    </article>
    <article>
     <header><h2>News 2 title</h2></header>
     <p>news 2</p>
    </article>
   </section>
  </article> 
 </section>
 <section>
  <header><h1>Another section</h1></header>
  <article>
   <p>Content of another section</p>
  </article>
 </section>
 <footer>
  <p>Copyright</p>
 </footer>
</body>

Your first header <header>Total news</header> would be a simple <H1> . 您的第一个标题<header>Total news</header>将是一个简单的<H1>

The <header><h1>News</h1></header> would be <hgroup><h1>News</h1></hgroup> (In this example you dont really need that container) <header><h1>News</h1></header><hgroup><h1>News</h1></hgroup> (在此示例中,您实际上并不需要该容器)

You also should think about your usage of Tags. 您还应该考虑使用Tag。 You don't have to use all of them just because it's the 'correct order'. 您不必仅仅因为这是“正确的顺序”就使用所有这些内容。 The less tags you use, the better. 使用的标签越少越好。

It is perfectly appropriate to put the <head> tag inside a <head> tag and it is even recommended according to this article http://www.anthonycalzadilla.com/2010/08/html5-section-aside-header-nav-footer-elements-not-as-obvious-as-they-sound/ . 这是完全适当的放<head>标签的内部<head>标签,它甚至建议根据本文http://www.anthonycalzadilla.com/2010/08/html5-section-aside-header-nav-页脚元素不像它们听起来那么明显/ The <article> tag can also be put inside a <section> tag based on this article http://html5doctor.com/the-article-element/ . 也可以根据本文http://html5doctor.com/the-article-element/<article>标记放在<section>标记内。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM