English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Basic Tutorial

HTML Media

HTML Reference Manual

HTML5 Basic Tutorial

HTML5 API

HTML5 Media

HTML Text Formatting

In this chapter, we will learn about HTML text formatting, that is, to add formatting to plain text

HTML Text Formatting

<strong>Bold text(oldtoolbag.com)</strong>
<br/><i>Italic text,w3codebox basic tutorial</i>
<br/><code>Code is automatically output</code>
<br/>This is element X<sub>subscript</sub>and X<sup>superscript</sup>
<br/>Chemical molecular formula: <b>C<sub>7</sub>H<sub>7</sub>F<sub>2</sub>N</b>
Test to see ‹/›

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 (please see the complete tag reference manual at the bottom).

The <strong> tag usually replaces the bold tag <b> to use, so it is recommended to use <strong> , <em> replaces the use of the <i> tag.
However, the meanings of these tags are different:

<b> and <i> define bold or italic text.
The <b> tag and the <strong> tag are two different tags. The <b> tag represents bold, indicated by the letter B, and the <b> tag can emphasize the bold effect of the font appearance. For example: <b>I am bold</b>
However, the <strong> tag is the place we want to emphasize, and these two tags have different meanings. For example: <strong>emphasize font</strong>.

<strong> or <em> means that the text you want to present is important, so it should be highlighted. All major browsers today can render various font effects. However, future browsers may support better rendering effects.

Online example

Ordinary text formatting
This example demonstrates how to format ordinary text in an HTML file.

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

"Computer output" tags
This example demonstrates the display effects of different "computer output" tags.

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

Abbreviations and initials
This example demonstrates how HTML implements abbreviations or initials.

Text direction
This example demonstrates how HTML changes the direction of text.

Block quote
This example demonstrates how HTML implements quotes of different lengths.

Deleted text effect and inserted text effect
This example demonstrates how HTML marks deleted text and inserted text.

HTML text formatting tags

LabelDescription
<b>Define bold text
<em>Define emphasized text
<i>Define italic text
<small>Define small text
<strong>Define emphasized tone
<sub>Define subscript text
<sup>Define superscript text
<ins>Define inserted text
<del>Define deleted text

HTML "computer output" tag

LabelDescription
<code>Define computer code
<kbd>Define keyboard code
<samp>Define computer code sample
<var>Define variable
<pre>Define preformatted text

HTML citation, quote, and tag definition

LabelDescription
<abbr>Define abbreviation
<address>Define address
<bdo>Define text direction
<blockquote>Define a long quote
<q>Define a short quote
<cite>Define a reference or citation
<dfn>Define a definition item.