内联文本元素
标记文本
突出运行文本由于在另一个语境的相关性,使用<mark>
标记。
You can use the mark tag to <mark>highlight</mark> text.
效果:
You can use the mark tag to highlight text.
被删除的文本
对于被删除的文本使用 <del>
标签。
<del>This line of text is meant to be treated as deleted text.</del>
效果:
This line of text is meant to be treated as deleted text.
无用文本
对于没用的文本使用 <s>
标签。
<s>This line of text is meant to be treated as no longer accurate.</s>
效果:
This line of text is meant to be treated as no longer accurate.
插入文本
额外插入的文本使用 <ins>
标签。
<ins>This line of text is meant to be treated as an addition to the document.</ins>
效果:
This line of text is meant to be treated as an addition to the document.
带下划线的文本
为文本添加下划线,使用 <u>
标签。
<u>This line of text will render as underlined</u>
效果:
This line of text will render as underlined
小号文本
对于不需要强调的inline或block类型的文本,使用 <small>
标签包裹,其内的
文本将被设置为父容器字体大小的 85%。标题元素中嵌套的 <small>
元素被设置不同的 font-size
。
你还可以为行内元素赋予 .small
类以代替任何<small>
元素。
<small>This line of text is meant to be treated as fine print.</small>
效果:
This line of text is meant to be treated as fine print.
着重
通过增加 font-weight
值强调一段文本。
The following snippet of text is<strong>rendered as bold text</strong>
效果:
The following snippet of text isrendered as bold text
斜体
用斜体强调一段文本。
The following snippet of text is <em>rendered as italicized text</em>.
效果:
The following snippet of text is rendered as italicized text.
Alternate elements
在 HTML5 中可以放心使用 <b> 和 <i> 标签。<b> 用于高亮单词或短语,不带有任何着重的意味;而 <i> 标签主要用于发言、技术词汇等。