gpt4 book ai didi

html -
标签是否应该在
标签内

转载 作者:搜寻专家 更新时间:2023-10-31 08:04:45 25 4
gpt4 key购买 nike

应该<main>被认为是重要的东西放在里面 <section> ?喜欢用 <main> 发表很多文章<section> 中的“文章” ?如果不是那么如何一起使用它们?

最佳答案

来自HTML5 specs :

Authors must not include more than one main element in a document.

Authors must not include the main element as a descendant of anarticle, aside, footer, header or nav element.

The main element represents the main content of the body of a documentor application.

因此,您应该使用 main 作为网站主要内容的分隔符,并使用 main 中的文章或部分作为上下文的分隔符,这里是如何处理 main 的示例:

<main>

<h1>Skateboards</h1>
<p>The skateboard is the way cool kids get around</p>

<article>
<h2>Longboards</h2>
<p>Longboards are a type of skateboard with a longer
wheelbase and larger, softer wheels.</p>
<p>... </p>
<p>... </p>
</article>

<article>
<h2>Electric Skateboards</h2>
<p>These no longer require the propelling of the skateboard
by means of the feet; rather an electric motor propels the board,
fed by an electric battery.</p>
<p>... </p>
<p>... </p>
</article>

</main>

注意:当联合元素的内容有意义时,鼓励作者使用 article 元素而不是 section 元素。

关于html - <main> 标签是否应该在 <section> 标签内,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20815584/

25 4 0