我知道这个主题有很多问题,但我找不到权威的答案来源。
这是官方定义和维基页面,还有更多文档,但他们没有解释正确的用法,除非在非常简单的例子或以不同的方式。
我目前所理解的:
<section>
定义页面的一部分(章节),例如博客列表、头条新闻、博客文章列表、评论列表,以及所有具有共同主题的内容。
<article>
定义与页面其他部分无关的有意义的内容(?)并且具有单一主题(博客文章、评论、文章等)。
但是,在<article>
中,我们可以使用<section>
将其分成部分,并在这种情况下,其功能是作为容器标记更大文本的章节。
疑问
如果这些句子是正确的(或部分正确),那么意味着<section>
有两个完全不同的用法。
我们可以按以下方式编写页面:
<!DOCTYPE html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>Fruits</title>
</head>
<body>
<h1>Fruits war blog</h1>
<section id="headlineNews"> <!-- USED AS CONTAINER -->
<h1>What's new about fruits?</h1>
<article><h1>Apples are the best</h1>Apples are better than bananas</article>
<article><h1>Apple's cakes</h1>With apples you can prepare a cake</article>
</section>
<section id="blogEntries"> <!-- USED AS CONTAINER -->
<h1>Articles about fruits</h1>
<article>
<h1>Apples vs Bananas</h1>
<section> <!-- USED AS CHAPTER -->
<h2>Introduction:</h2>
Bananas have always leaded the world but...
</section>
<section> <!-- USED AS CHAPTER -->
<h2>The question:</h2>
Who is the best? We don't know so much about apples...
</section>
</article>
</section>
</body>
</html>
这是大纲的样子:
1. Fruits war blog
1. What's new about fruits?
1. Apples are the best
2. Apple's cakes
2. Articles about fruits
1. Apples vs Bananas
1. Introduction:
2. The question:
因此,<section>
被认为具有两个完全不同且不相关的语义含义?
这样使用是否正确:
<!-- MY DOUBT -->
<section> <!-- USED AS CONTAINER -->
<article>
<section></section> <!-- USED AS CHAPTER -->
</article>
</section>
在这个嵌套的方式中?
我发现可以反过来使用。
<!-- FROM W3C -->
<article> <!-- BLOG ENTRY -->
<section> <!-- USED AS CHAPTER ABOUT COMMENTS -->
<article></article> <!-- COMMENT -->
</section>
</article>
但是我找不到对我以下写法的答案。
我猜测阅读W3C小组撰写<section>
标签基础的讨论可能会有用,但我无法找到它。
注:我正在寻找带有权威来源文件的回复。
article
是section
的更具体的等价物吗? - Fez Vrasta