HTML 格式化标签 HTML Formatting Elements
HTML格式,如字体格式(粗体、斜体、下划线、删除线、上标、下标、高亮标记等)。
In the previous chapter, you learned about the HTML style attribute.
HTML also defines special elements for defining text with a special meaning.
HTML uses elements like <b> and <i> for formatting output, like bold or italic text.
Formatting elements were designed to display special types of text:
<b>
- Bold text定义粗体文本 -->The HTML<b>
element defines bold text, without any extra importance.
<b>
This text is bold</b>
<strong>
- Important text 定义加重语气 --> The HTML<strong>
element defines strong text, with added semantic "strong" importance.
<strong>
This text is strong</strong>
<i>
- Italic text 定义斜体字 --> the HTML<i>
element defines italic text, without any extra importance.
<i>
This text is italic</i>
<em>
- Emphasized text 定义着重文字 --> The HTML<em>
element defines emphasized text, with added semantic importance.
<em>
This text is emphasized</em>
Note: Browsers display
<strong>
as<b>
, and<em>
as<i>
. However, there is a difference in the meaning of these tags:<b>
and<i>
defines bold and italic text, but<strong>
and<em>
means that the text is "important".
<mark>
- Marked text 定义高亮字 --> The HTML<mark>
element defines marked or highlighted text:
<h2>
HTML<mark>
Marked</mark>
Formatting</h2>
<small>
- Small text 定义小号字 --> The HTML <small> element defines smaller text:
<h2>
HTML<small>
Small</small>
Formatting</h2>
<del>
- Deleted text 定义删除线 --> The HTML <del> element defines deleted (removed) text.
<p>
My favorite color is<del>
blue</del>
red.</p>`<ins>
- Inserted text 定义插入字 --> The HTML <ins> element defines inserted (added) text.
<p>
My favorite<ins>
color</ins>
is red.</p>
<sub>
- Subscript text 定义下标字 --> The HTML<sub>
element defines subscripted text.
<p>
This is<sub>
subscripted</sub>
text.</p>
<sup>
- Superscript text 定义上标字 --> The HTML element defines superscripted text.
<p>
This is<sup>
superscripted</sup>
text.</p>
HTML "计算机输出" 标签
-
<code>
定义计算机代码 -
<kbd>
定义键盘码 -
<samp>
定义计算机代码样本 -
<var>
定义变量 -
<pre>
定义预格式文本
HTML 引文, 引用, 及标签定义
-
<abbr>
Defines an abbreviation or acronym 定义缩写 The HTML <abbr> element defines an abbreviation or an acronym. Marking abbreviations can give useful information to browsers, translation systems and search-engines.
<p>The <abbr title="World Health Organization">WHO</abbr> was founded in 1948.</p>
-
<address>
Defines contact information for the author/owner of a document 定义地址The HTML <address> element defines contact information (author/owner) of a document or an article. The <address> element is usually displayed in italic. Most browsers will add a line break before and after the element.
<address>
Written by John Doe.<br>
Visit us at:<br>
Example.com<br>
Box 564, Disneyland<br>
USA
</address>
-
<bdo>
Defines the text direction 定义文字方向 The HTML <bdo> element defines bi-directional override. The <bdo> element is used to override the current text direction:
<bdo dir="rtl">This text will be written from right to left</bdo>
-
<blockquote>
Defines a section that is quoted from another source 定义长的引用 The HTML <blockquote> element defines a section that is quoted from another source. Browsers usually indent <blockquote> elements.
<p>Here is a quote from WWF's website:</p>
<blockquote cite="http://www.worldwildlife.org/who/index.html">
For 50 years, WWF has been protecting the future of nature.
The world's leading conservation organization,
WWF works in 100 countries and is supported by
1.2 million members in the United States and
close to 5 million globally.
</blockquote>
-
<q>
Defines a short inline quotation 定义短的引用语 The HTML <q> element defines a short quotation. Browsers usually insert quotation marks around the <q> element.
<p>WWF's goal is to: <q>Build a future where people live in harmony with nature.</q></p>
-
<cite>
Defines the title of a work 定义引用、引证 The HTML <cite> element defines the title of a work. Browsers usually display <cite> elements in italic.
<p><cite>The Scream</cite> by Edvard Munch. Painted in 1893.</p>
-
<dfn>
定义一个定义项目