HTML 文本格式化

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> 定义一个定义项目
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 12,172评论 0 10
  • 文|十月梦马 “学长,我不是害怕孤独,也不是没有努力,而是怕努力了没有结果,最后回到了合群的起点――寝室,开始堕落...
    陈过年kk阅读 1,819评论 0 4
  • 第五十五章八十三言 【文】 傅奕《道德经古本篇》第五十五章 含德之厚者,比之於赤子也。蜂虿不螫,猛兽不据,攫鸟不搏...
    孤鸿学士阅读 5,847评论 2 6
  • 人,最好的心态是平静;最好的状态是简单;最好的感觉是自由;最好的心情是童心。 ...
    书墨香阅读 3,570评论 2 3
  • 最近一个深刻的体会: 我想把一个想法、概念、观念表达出来,却发现表达不清楚,换一个说法就是我写过的文章,如果回头再...
    丁昆朋阅读 1,445评论 0 0

友情链接更多精彩内容