Which HTML5 tag should I use to mark up an author’s name?(我应该使用哪个 HTML5 标签来标记作者姓名?)
问题描述
例如博客文章或文章.
<article>
<h1>header<h1>
<time>09-02-2011</time>
<author>John</author>
My article....
</article>
author
标签并不存在……那么,作者常用的 HTML5 标签是什么?谢谢.
The author
tag doesn't exist though... So what is the commonly used HTML5 tag for authors?
Thanks.
(如果没有,不应该有一个吗?)
(If there isn't, shouldn't there be one?)
推荐答案
两者 rel="author"
和 <address>
正是为此目的而设计的.两者都在 HTML5 中受支持.规范告诉我们 rel="author"
可用于 <link>
<a>
和 <area>
元素.Google 还推荐 用法.结合使用 <address>
和 rel="author"
似乎是最佳选择.HTML5 最适合包装 <article>
<header>
中的标题和署名信息,如下所示:
Both rel="author"
and <address>
are designed for this exact purpose. Both are supported in HTML5. The spec tells us that rel="author"
can be used on <link>
<a>
, and <area>
elements. Google also recommends its usage. Combining use of <address>
and rel="author"
seems optimal. HTML5 best affords wrapping <article>
headlines and bylines info in a <header>
like so:
<article>
<header>
<h1 class="headline">Headline</h1>
<div class="byline">
<address class="author">By <a rel="author" href="/author/john-doe">John Doe</a></address>
on <time pubdate datetime="2011-08-28" title="QXVndXN0IDI4dGgsIDIwMTE=">8/28/11</time>
</div>
</header>
<div class="article-content">
...
</div>
</article>
pubdate
属性表明这是发布日期.The
pubdate
attribute indicates that that is the published date.title
属性是可选的天桥.署名信息也可以包装在 <footer>">
<文章>
The byline info can alternatively be wrapped in a
<footer>
within an<article>
如果你想添加 hcard 微格式,我会这样做就像这样:
If you want to add the hcard microformat, then I would do so like this:
<article> <header> <h1 class="headline">Headline</h1> <div class="byline vcard"> <address class="author">By <a rel="author" class="url fn n" href="/author/john-doe">John Doe</a></address> on <time pubdate datetime="2011-08-28" title="QXVndXN0IDI4dGgsIDIwMTE=">on 8/28/11</time> </div> </header> <div class="article-content"> ... </div> </article>
这篇关于我应该使用哪个 HTML5 标签来标记作者姓名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:我应该使用哪个 HTML5 标签来标记作者姓名?


- Fetch API 如何获取响应体? 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07