gpt4 book ai didi

HTML5 -

是否被认为是

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

我有一个包含最新消息和随机博客文章等的边栏

<nav id="sidebar">
<section id="latest_news">
<h1>
Latest News
</h1>
<h2>
<a href="/path/to/article">News Item 1</a>
</h2>
<p>
Truncated text from the news item in question
</p>
<a href="/news" title="View all news items" class="index">View all news items</a>
</section>

<section id="random_blog_post">
<h1>
Random Blog Post
</h1>
<h2>
<a href="/path/to/blog/post">Blog Post 1</a>
</h2>
<p>
Truncated text from the random blog post in question
</p>
<a href="/blog" title="View all blog posts" class="index">View all blog posts</a>
</section>
</nav>

如您所见,我的导航栏中有部分、h1 和段落。

我只是想知道这是否允许或被认为是良好做法。是否有更好的语义(或更少)方法来标记和构建此类侧边栏内容?

最佳答案

是的,这似乎是非常有效的 html5。 w3org 有一个 example带有 h1 标签的导航。

关于HTML5 - <p> 和 <h1> 是否被认为是 <nav> 的有效内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6440792/

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