<节>或包含在其中的< article&gt ;. [英] <section> or <article>, which is contained in which

查看:99
本文介绍了<节>或包含在其中的< article&gt ;.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



是否有一个< 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?

这篇关于&lt;节&GT;或包含在其中的&lt; article&gt ;.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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