gpt4 book ai didi

每一级标题的 HTML5 字幕标记,即 h1 到 h6

转载 作者:行者123 更新时间:2023-12-03 23:18:30 25 4
gpt4 key购买 nike

包括 WordPress 官方模板,有很多资源解释了如何编码“h1”和“h2”用“header”标签包装以将副标题包含为“p”标签。

例如,

  <main>  
<header>
<h1>The Title For The Site</h1>
<p>The subtitle goes here</p>
</header>
...
</main>

或者对于存档页面:
  <main>  
<header>
<h1>The Title For The Site</h1>
<p>The subtitle goes here</p>
</header>
<article>
<header>
<h1>The Title Of An Article</h1>
<p>The subtitle for the article</p>
</header>
...
</article>
...
</main>

那么问题来了:
如果我也需要这些级别的字幕,那么 h3 到 h6 标题的其他级别会是什么?

在语义上是否可以标记如下:
      <main>  
<header>
<h1>The Title For The Site</h1>
<p>The subtitle goes here</p>
</header>
<p>Lorem ipsum dolor sit amet, consectetur ... dignissim.</p>

<header>
<h3>Fusce rutrum</h3>
<p>Vestibulum commodo gravida tortor</p>
</header>
<p>....</p>

<header>
<h4>Praesent eget</h4>
<p> Maecenas malesuada vel lectus</p>
</header>
<p>....</p>
...
</main>

请给一些建议!提前致谢。

最佳答案

对,那是正确的。在这种情况下,标题等级不是相关的差异。重要的是你不要为副标题使用另一个标题元素。

另请参见 HTML 5.1 规范:Subheadings, subtitles, alternative titles and taglines

关于每一级标题的 HTML5 字幕标记,即 h1 到 h6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43178019/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com