我何时将< h1> - < h6>在< header>内部元件? [英] When do I put <h1>-<h6> inside an <header> element?

查看:104
本文介绍了我何时将< h1> - < h6>在< header>内部元件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

何时将标题放在标题元素内?我无法理解,有时在我看来,每个标题必须在标题标签之间。

When do I put headings inside a header element? I can't understand it, sometimes it seems to me that each heading has to be between header tags.

让我们以这个边栏为例:


Let's take this sidebar as example :

如何编码?

How to code it?

<aside>
  <header>
    <h1>How to format</h1>
  </header>
</aside>

<aside>
  <h1>How to format</h1>
</aside>


推荐答案

请参阅 header 元素:

See the specification of the header element:


标题元素通常包含部分的标题
(一个h1-h6元素),但这不是必需的。 header元素可以使用
来包装节的内容表,搜索表单或者
任何相关的标志。

A header element is intended to usually contain the section's heading (an h1–h6 element), but this is not required. The header element can also be used to wrap a section's table of contents, a search form, or any relevant logos.

因此,您可以在页面中拥有多个页眉元素(不限于页面的顶部),您可以在标题中使用它,但它是可选的。这意味着你的两个例子都是正确的。

So you can have many header elements in a page (it's not limited to the top of the page), and you can use it around headings, but it's optional. This means both of your examples are correct.

这篇关于我何时将&lt; h1&gt; - &lt; h6&gt;在&lt; header&gt;内部元件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆