问题描述
标题下的简短介绍的最佳语义 HTML 标签是什么?我确定它有一个名字,因为很多网站都有这个名字,但我似乎找不到它或合适的标签。
<h1>Page Title</h1>
<h2>Section Title</h2>
<div>Short blurb about this section</div>
<div>Section content</div>
解决方法
您可以使用小标签代替 p 标签,就像我在下面所做的那样。此页面应该有助于https://www.w3schools.com/html/html_formatting.asp
<header>
<h1>HTML 5.1 Nightly</h1>
<small>A vocabulary and associated APIs for HTML and XHTML</small>
<small>Editor’s Draft 9 May 2013</small>
</header>
我在发布这篇文章后不久就找到了我的问题的答案。根据 W3,我应该将标题和简介(他们称之为副标题)包装在 <header>
标签中:
示例 4:在以下示例中,新闻文章的标题和标语使用 <header>
元素进行分组。标题使用 h2
元素标记,标语在 p
元素中。代码示例下方提供了标题和标语的示例 CSS 样式呈现。
<header>
<h2>3D films set for popularity slide </h2>
<p>First drop in 3D box office projected for this year despite hotly tipped summer blockbusters,according to Fitch Ratings report</p>
</header>