< article>之间的混淆或< section>标签。使用哪个? [英] Confusion between <article> or <section> tags. Which to use?
问题描述
尽管在页面上阅读了关于< article>
和< section>
标签的页面,我真的不喜欢了解如何将它们应用到我的网站。
Despite reading pages upon pages about the <article>
and <section>
tags I really don't understand how to apply them to my site.
我在页面末尾有一个包含相关产品的产品页面。首先我想做这样的事情:
I have a product page with related products at the end of the page. First I thought about doing something like this:
<section>
<header><h1>Product title</h1><header>
<img src="image.jpg"/>
<p>Description</p>
<p>Price</p>
<p><a href="...">Order</a></p>
</section>
<section>
<header><h1>Related products</h1></header>
<article>
<a href="..."><img src="image1.jpg"><br/>Product 1</a><br/>Price
</article>
<article>
<a href="..."><img src="image2.jpg"><br/>Product 2</a><br/>Price
</article>
<article>
<a href="..."><img src="image3.jpg"><br/>Product 3</a><br/>Price
</article>
</section>
但是,然后我读了一些其他博客,它发生在我身上,也许我应该替换< section>
标有< article>
标签。
But, then I read some other blogs and it occured to me that maybe I should replace the <section>
tags with <article>
tags.
哪个是对的?为什么?谢谢。
Which is right and why? Thanks.
推荐答案
部分
section元素表示文档或应用程序的通用部分。在这种情况下,一节是内容的主题分组。应该识别每个部分的主题,通常通过将标题(h1-h6元素)包括为section元素的子元素。
The section element represents a generic section of a document or application. A section, in this context, is a thematic grouping of content. The theme of each section should be identified, typically by including a heading (h1-h6 element) as a child of the section element.
文章
文章元素表示文档页面中的完整或自包含的组合,应用程序或站点,原则上,可独立分发或可重复使用,例如在联合组织中。这可以是论坛帖子,杂志或报纸文章,博客条目,用户提交的评论,交互式小部件或小工具,或任何其他独立的内容项目。
The article element represents a complete, or self-contained, composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content.
当嵌套article元素时,内部article元素表示原则上与外部文章的内容相关的文章。例如,网站上接受用户提交的评论的博客条目可以将评论表示为嵌套在博客条目的文章元素中的文章元素。
When article elements are nested, the inner article elements represent articles that are in principle related to the contents of the outer article. For instance, a blog entry on a site that accepts user-submitted comments could represent the comments as article elements nested within the article element for the blog entry.
直接从W3 http:// www。 w3.org/html/wg/drafts/html/master/sections.html
在他们的例子中,他们在文章
部分中嵌套文章
>。我会说你肯定是正确使用它。
In their example, they have an article
nested within a section
within an article
. I would say you are definitely using it correctly.
<article>
<header></header>
<section>
<h1></h1>
<article></article>
<article></article>
</section>
</article>
这篇关于< article>之间的混淆或< section>标签。使用哪个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!