Html html5中<article>和<section>有什么区别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33910294/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the difference between <article> and <section> in html5
提问by happenask
When should I use <article>
and <section>
tags in HTML5?
什么时候应该在 HTML5 中使用<article>
和<section>
标签?
采纳答案by Nick Zuber
The <section>
tag:
该<section>
标签:
The section tag defines sections in a document, such as chapters, headers, footers, or any other sections of the document.
section 标签定义文档中的部分,例如章节、页眉、页脚或文档的任何其他部分。
The <article>
tag:
该<article>
标签:
The article tag specifies independent, self-contained content.
An article should make sense on its own and it should be possible to distribute it independently from the rest of the site.
Potential sources for the article element:
- Forum post
- Blog post
- News story
- Comment
文章标签指定独立的、自包含的内容。
一篇文章本身应该有意义,并且应该可以独立于站点的其余部分进行分发。
文章元素的潜在来源:
- 论坛帖子
- 博文
- 新闻故事
- 评论
Basically these tags are semantic elementsand the only real difference between them are readability and design preference.
基本上这些标签是语义元素,它们之间唯一真正的区别是可读性和设计偏好。
You can read more about them here if you wish:
如果您愿意,可以在此处阅读有关它们的更多信息:
回答by vijayscode
Article tag
文章标签
The article tag is used for wrapping an autonomous content on a page. A content is autonomous if it can be removed from the page and put on some another page.
article 标签用于在页面上包装自主内容。如果内容可以从页面中删除并放在另一个页面上,则该内容是自主的。
Section tag
部分标签
The section tag is similar to the div tag, but it is more meaningful since it wraps logical groups of related content (e.g. a chapter of an article).
section 标签类似于 div 标签,但它更有意义,因为它包装了相关内容的逻辑组(例如文章的一章)。
More about semantic tags - https://www.pluralsight.com/guides/semantic-html