HTML Text Formatting

Example

HackerThink Bold text

Italic text

Computer code

This is the subscript and superscript

HTML formatting tags

HTML uses tags <b>(“bold”) and <i>(“italic”) to format the output text, such as bold or italic

These HTML tags are called formatting tags (see the full tags reference manual at the bottom).

Usually the tag replaces the bold tag to use, and the replaces the tag to use.

However, the meaning of these tags is different:

<b> and <i> define bold or italic text.

or means that the text you want to present is important, so highlight it. All major browsers today can render fonts with various effects. However, future browsers may support better rendering effects.

Online examples

Text formatting
This example demonstrates how to format text in an HTML file

Preformatted text
This example demonstrates how to use the pre tag to control blank lines and spaces.

“Computer output” label
This example demonstrates the display effects of different “computer output” labels.

Address
This example demonstrates how to write an address in an HTML file.

Abbreviations and acronyms
This example demonstrates how to implement abbreviations or acronyms.

Text direction
This example demonstrates how to change the direction of text.

Block quotes
This example demonstrates how to implement quotes of varying lengths.

Delete word effect and insert word effect
This example demonstrates how to mark deleted text and inserted text.

HTML text formatting tags

Label Description
<b>
Define bold text
<em>
Define text-focused
<i>
Define italics
<small>
Define small font
<strong>
Defining strong font
<sub>
Define subscript words
<sup>
Define superscript words
<ins>
Define inserted words
<del>
Definition delete word

HTML “computer output” tag

Label Description
<code>
Define computer code
<kbd>
Define keyboard code
<samp>
Define computer code samples
<var>
Define variables
<pre>
Define pre-formatted text

HTML citations, quotes, and tag definitions

Label Description
<abbr>
Define abbreviations
<address>
Define address
<bdo> 定义文字方向
<blockquote>
Define text direction
<q>
Define short quotes
<cite>
Define citations, citations
<dfn>
Define a definition item.