HTML 5 Section 和 Main 语义标签使用

HTML 5 Section and Main semantic tags use

在研究 HTML 5 个语义标签时,我 运行 对如何正确使用 mainsection 标签,并且由于 W3Schools 参考似乎有点含糊,网络上的其他参考似乎有所不同,我想知道是否有针对以下问题的适当指南,或者它是否漂亮很大程度上取决于程序员:

  1. main 标签是否也具有对相关元素进行分组的意义,或者在那种情况下它应该在 section 标签内吗?
  2. 将单个元素(例如图像)包装到 section 标签中是否有意义?
  3. 页面的 headerfooter 是很常见的(不在任何部分内),在这种情况下,应该保留在这些标签之间的是包裹在 section 标签内,就像分隔页面的 "content" 一样?

Does the main tag also has the meaning of grouping related elements

仅在 <div> 对相关元素进行分组的范围内。 <main> 的主要目的是指示页面主要内容的起始位置。 (此外,根据 WHATWG 规范而非 W3C 规范,页面的主要内容 恢复 )。

or in that case should it be within a section tag?

节标签是对内容进行分组的一种方式,用于指示其内容属于特定主题,与不在节中的内容不同。通常,您可以而且应该使用 <h[1-6]> 元素为该部分指定一个标题,该元素说明该主题是什么。

Does it make sense to wrap single elements, such as an image, into a section tag?

很少。一方面,这意味着该部分不包含标题。往上看。将图像单独包装在部分标记中不太可能传达任何新信息。

It's pretty common to have a header and footer of the page (not inside any section), in that case, should the remaining in between those tags be wrapped inside a section tag, as if delimiting the "content" of the page?

没有。该部分的 "content" 是减去其 header 和页脚的部分。无需添加另一个分区元素容器。