html – 正确使用标签,或如何标记“不太重要”的文字

前端之家收集整理的这篇文章主要介绍了html – 正确使用标签,或如何标记“不太重要”的文字前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
另一个在HTML5中被赋予了新意义的标签,< small>显然生活在:

07000

The small element represents so-called “fine print” or “small print”,
such as legal disclaimers and caveats.

这个非官方的参考似乎有点进一步:

07001

<small> is now for side comments,which are the inline equivalent of
<aside> — content which is not the main focus of the page. A common
example is inline legalese,such as a copyright statement in a page
footer,a disclaimer,or licensing information. It can also be used
for attribution.

我有一个我想显示的人的列表,其中包括他们的真实姓名和昵称。昵称是一种“旁边”,我想用较轻的文本进行风格化:

<li>Laurence Tureaud <small>(Mr.T)</small></li>

我需要为网站的几个部分(人员,产品,位置)做这些事情,所以我正在制定一个明智的标准。我知道我可以使用< span class =“quiet”>或者这样的东西,但是我试图避免任意的类名,并使用正确的HTML元素(如果有的话)。

是< small>适合这个,还是有适当的元素或标记结构?

解决方法

你所看的规格是旧的,你应该看看HTML5规范:

https://html.spec.whatwg.org/multipage/

我建议< em>这里而不是小:

<p>Laurence Tureaud also called <em>Mr. T</em> is famous for his role
in the tv series A-TEAM.</p>

<小>在文章中不常用,但像这样:

<footer>
    <p>
    Search articles about <a href="#">Laurence Tureaud</a>,<small>or try <a href="#">articles about A-TEAM</a>.</small>
    </p>
</footer>

<footer>
    <p>
    Call the Laurence Tureaud's "life trainer chat line" at
    555-1122334455 <small>($1.99 for 1 minute)</small>
    </p>
</footer>

文章

<p>
    My job is very interesting and I love it: I work in an office
    <small>(123 St. Rome,Italy)</small> with a lot of funny guys that share
    my exact interests.
</p>
原文链接:https://www.f2er.com/html/233549.html

猜你在找的HTML相关文章