<节>或包含在其中的< article> ;. [英] <section> or <article>, which is contained in which
问题描述
是否有一个< section>
属于< article>
,还是反过来?它甚至是重要的吗?
我正在考虑重新构造一个WordPress博客。
解决方案来自 HTML5规范:
部分
元素表示通用文档或应用程序部分。在这种情况下,部分是内容的主题分组,通常包含标题和可能的页脚。
和
文章元素表示文档,页面或网站的独立部分。这可以是论坛帖子,杂志或报纸文章,博客文章,用户提交的评论或任何其他独立内容项目。
所以我会说部分
和文章
元素可以包含其他元素(如果适用)。我认为你的图很有意义,除了嵌套的section元素外:
section元素不是一个通用的容器元素。当为了样式目的而需要一个元素或为脚本编写提供便利时,鼓励作者使用div元素。一般的规则是,section元素只有在元素的内容将在文档的大纲中明确列出时才适用。
也许使用a < div>
对于外面的那个?
Trying to get my head around the new semantic elements in HTML5.
Does a <section>
belong inside an <article>
or is it the other way around? Does it even matter?
I'm looking at re-structuring a wordpress blog.
From the HTML5 spec:
The
section
element represents a generic document or application section. A section, in this context, is a thematic grouping of content, typically with a header and possibly a footer.
and
The
article
element represents an independent section of a document, page, or site. This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, or any other independent item of content.
So I would say both section
and article
elements can contain the other element, if appropriate. I think your diagram makes sense, apart from the nested section elements:
The section element is not a generic container element. When an element is needed for styling purposes or as a convenience for scripting, authors are encouraged to use the div element instead. A general rule is that the section element is appropriate only if the element's contents would be listed explicitly in the document's outline.
Maybe use a <div>
for the outer one?
这篇关于<节>或包含在其中的< article> ;.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!