简体   繁体   English

在HTML5中,我应该使用文章或部分标签来制作标签吗?

[英]In HTML5 should I use article or section tags to make tabs?

I want to create a set of content tabs for a design I'm building in HTML5. 我想为我在HTML5中构建的设计创建一组内容选项卡。 I'm wondering if I should use a set of <article> or <section> tags to contain the content? 我想知道我是否应该使用一组<article><section>标签来包含内容?

<section> seems ideal to me. <section>对我来说似乎很理想。 Its definition applies quite neatly to something like content tabs: 它的定义非常巧妙地适用于内容标签:

The section element represents a generic section of a document or application. section元素表示文档或应用程序的通用部分。 A section, in this context, is a thematic grouping of content, typically with a heading. 在此上下文中,部分是内容的主题分组,通常带有标题。

Examples of sections would be chapters, the various tabbed pages in a tabbed dialog box, or the numbered sections of a thesis. 部分的示例可以是章节,选项卡式对话框中的各种选项卡式页面,或论文的编号部分。 A Web site's home page could be split into sections for an introduction, news items, and contact information. 网站的主页可以分为几个部分,用于介绍,新闻和联系信息。

Take note of what it says about <article> on that same page though: 请注意同一页面上关于<article>内容:

Authors are encouraged to use the article element instead of the section element when it would make sense to syndicate the contents of the element. 鼓励作者使用article元素而不是section元素,因为联合元素的内容是有意义的。

So if the content of your tabs is self-contained and makes sense when read in isolation (and could be used that way), use <article> , if it doesn't use <section> . 因此,如果选项卡的内容是自包含的并且在单独读取时有意义(并且可以这样使用),请使用<article> ,如果它不使用<section>

It is my understanding that <section> elements are supposed to go inside <article> elements, so you shouldn't use sections for tabs unless you wrap all of the tabs inside of an article. 我的理解是<section>元素应该放在<article>元素内部,因此除非将所有选项卡包装在文章中,否则不应使用sections作为选项卡。 So the short answer is you should use both or neither. 所以简短的回答是你应该使用两者或两者都不使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM