简体   繁体   English

SECTION中的语义HTML文章

[英]Semantic HTML ARTICLES within SECTION

I've been reading a lot about Semantic HTML lately and I've been looking at examples at MDN and www.w3.org. 最近,我阅读了很多有关语义HTML的文章,并在MDN和www.w3.org上查看了示例。 However I can not find an explicit answer to this: 但是我找不到对此的明确答案:

Is it semantically correct to have a section with articles as content? 将文章作为内容的部分在语义上是否正确?

Something along the lines of this: 与此类似:

<section>
  <h2>Latest Posts</h2>
  <article></article>
  <article></article>
  <article></article>
</section>

Closest I've found to that structure is what Morten Rand did at his site: https://mor10.com/ But he's not wrapping the articles with a section but a main tag instead. 我发现与该结构最接近的是Morten Rand在他的网站上所做的事情: https : //mor10.com/但他没有将文章包装成一个部分,而是一个主要标签。

Yes, you can 是的你可以

A <section> element simply represents a generic section of the page. <section>元素仅表示页面的通用部分。 A section on the page can most definitely contain an <article> . 页面上的某个部分绝对可以包含<article>

This page talks about the <article> tag, but it does discuss using it inside of a <section> element, confirming this: 该页面讨论了<article>标签,但确实在<section>元素内讨论了如何使用它,并确认了这一点:

Where appropriate a <section> element can contain <article> elements. 在适当的情况下, <section>元素可以包含<article>元素。

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

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