如果我拼错了,请原谅我,请更正。
我不知道如何使用这两个元素( Article
| Section
)
现在我想启动一个具有完全标准 HTML 代码的站点,
现在,您认为我网站上的文章应该如何组织?我在哪里可以更好地放置站点标题?
我被困在这两个选项之间。
<!-- 1 -->
<section>
<header>
<h1>title of page</h1>
</header>
<article>
<p>some text</p>
</article>
</section>
<!-- 2 -->
<section>
<article>
<header>
<h1>title of page</h1>
</header>
</article>
<p>some text</p>
</section>
如果两者都不正确,您有什么建议?我的英文很差。所以我不能再使用任何问题了。但我理解编码。请写代码和简单的句子给我解释,不要说你的问题有答案。
最佳答案
阅读有关 的更多信息HTML element article
Mozilla 的:
The HTML element represents a self-contained composition in a document, page, application, or site, which is intended to be independently distributable or reusable (e.g., in syndication)... each post would be contained in an element, possibly with one or more s within.
不像
article
元素, section
element :The HTML element represents a generic standalone section of a document, which doesn't have a more specific semantic element to represent it.
因此,article 元素可以包含 section 元素。但是
section
element 不能包含任何其他语义元素。因此,您的示例可以如下所示:
<header>
<h1>The article News from Valinor of Gandalf</h1>
</header>
<article>
<h2>News from Valinor</h2>
<p>A short introduction to the content of the article.</p>
<section>
<h3>The name of section</h3>
<p>The content of section.</p>
</section>
<section>
<h3>The name of section</h3>
<p>The content of section.</p>
</section>
...
</article>
<footer>
<h2>Publisher and copyright holder</h2>
<p>Publisher and © 2021 Gandalf</p>
</footer>
关于html - 使用 <section> 和 <article> 进行 SEO 的正确方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69222379/