HTML Text Formatting


HTML Text Formatting

Bold Text

Italic Text

Automatic computer output

This isSubscriptandSuperscript

Try It »

Formatting Tags

HTML Using tags <b>("bold") and <i>("italic") to format output text, as shown:Bold or Italic

These HTML tags are called formatting tags (please refer to the complete tag reference manual at the bottom).

Remark Typically, the <strong> tags replace the <b> tags for use, and <em> tags replace <i> tags.

However, the meanings of these tags are different:

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

<strong> or <em> indicate text that is important and should be highlighted. Modern major browsers can render various effects on fonts. However, future browsers may support better rendering effects.


Examples

Online Examples

HTML 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 line breaks and spaces.

"Computer Output" Tag
This example demonstrates different display effects of the "Computer Output" tags.

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

Abbreviations and Initialism
This example demonstrates how to implement abbreviations or initialisms.

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

Block Quotation
This example demonstrates how to implement varying-length quotations.

Delete Text Effect and Insert Text Effect
This example demonstrates how to mark deleted and inserted text.


HTML Text Formatting Tags

Tag Description
<b> Define Bold Text
<em> Define Italic Text
<i> Define Italic Text
<small> Define Small Text
<strong> Define Strong Emphasis
<sub> Define Subscript
<sup> Define Superscript
<ins> Define Inserted Text
<del> Define Deleted Text

HTML "Computer Output" Tag

Tag Description
<code> Define Computer Code
<kbd> Define Keyboard Codes
<samp> Define Computer Code Sample
<var> Define Variable
<pre> Define Preformatted Text

HTML Citations, Citations, and Tag Definitions

Tag Description
<abbr> Define Abbreviation
<address> Define Address
<bdo> Define Text Direction
<blockquote> Define Long Quotation
<q> Define Short Quotation
<cite> Define Quotation, Citation
<dfn> Define a Definition Item
Other Extensions