Text formatting in HTML


In HTML texts can be formatted in many ways:
  1. Bold
  2. Italic
Few important HTML display properties:
  • Marked text
  • Strong text
  • Deleted text
  • Selected text
  • Emphasized text
  • Small text
  • Inserted text
  • Subscripted text
  • Superscripted text

Bold text in HTML

For making text bold in HTML place it in between <b> and </b> tags.

Example:

<!DOCTYPE html>
<html>
<head>
<title>
Changing text size in HTML </title>
</head>
<body>
<p>This is paragraph.This is not bold.</p>
<p><b>This is paragraph.This is bold</b></p>
</body>
</html>

Output:

This is paragraph.This is not bold.

This is paragraph.This is bold.

Italic text in HTML

For making text italic in HTML place text in between <i> and </i> tags.

Example:

<!DOCTYPE html>
<html>
<head>
<title>
Changing text size in HTML </title>
</head>
<body>
<p>This is paragraph.This is not italic.</p>
<p><i>This is paragraph.This is italic</i></p>
</body>
</html>

Output:

This is paragraph.This is not italic.

This is paragraph.This is italic.

Marked text in HTML

For making text marked place it in between <mark> and </mark> tags.

Example:

<!DOCTYPE html>
<html>
<head>
<title>
Changing text size in HTML </title>
</head>
<body>
<p>This is paragraph.This is not marked.</p>
<p><mark>This is paragraph.This is marked</mark></p>
</body>
</html>

Output:

This is paragraph.This is not marked.

This is paragraph.This is marked.

Strong text in HTML

For making text strong in HTML place them in between <strong> and </strong> tags.

Example:

<!DOCTYPE html>
<html>
<head>
<title>
Changing text size in HTML </title>
</head>
<body>
<p>This is paragraph.This is not strong.</p>
<p><srong>This is paragraph.This is strong.</strong></p>
</body>
</html>

Output:

This is paragraph.This is not strong.

This is paragraph.This is strong.

Deleted text in HTML

For making text Deleted place them in between <del> and </del> tags.

Example:

<!DOCTYPE html>
<html>
<head>
<title>
Changing text size in HTML </title>
</head>
<body>
<p>This is <del>paragraph</del> text.This is not strong.</p>
<p><srong>This is paragraph.This is strong.</strong></p>
</body>
</html>

Output:

This is paragraph text.This is not strong.

This is paragraph.This is strong.

Emphasized text in HTML

For making text emphasized place them in between <em> and </em> tags.

Example:

<!DOCTYPE html>
<html>
<head>
<title>
Changing text size in HTML </title>
</head>
<body>
<p>This is <em>paragraph</em> text.This is not emphasized.</p>
</body>
</html>

Output:

This is paragraph text.This is not strong.

Small text in HTML

For making text small place them in between <small> and </small> tags.

Example:

<!DOCTYPE html>
<html>
<head>
<title>
Changing text size in HTML </title>
</head>
<body>
<p>THIS IS PARAGRAPH.THIS IS NOT <small>SMALL.</small>
</body>
</html>

Output:

THIS IS PARAGRAPH.THIS IS NOT SMALL.

Inserting text in HTML

For inserting text in HTML place them in between <ins> and </ins> tags.

Example:

<!DOCTYPE html>
<html>
<head>
<title>
Changing text size in HTML </title>
</head>
<body>
<p>THIS IS PARAGRAPH.THIS IS NOT <ins>SMALL.</ins>
</body>
</html>

Output:

THIS IS PARAGRAPH.THIS IS NOT SMALL.

Subscripted text in HTML

For subscripting text in HTML place them in between <sub> and </sub> tags.

Example:

<!DOCTYPE html>
<html>
<head>
<title>
Changing text size in HTML </title>
</head>
<body>
<p>THIS IS PARAGRAPH.THIS IS NOT <sub>SMALL.</sub>
</body>
</html>

Output:

THIS IS PARAGRAPH.THIS IS NOT SMALL.

Superscripted text in HTML

For superscripting text in HTML place them in between <sup> and </sup> tags.

Example:

<!DOCTYPE html>
<html>
<head>
<title>
Changing text size in HTML </title>
</head>
<body>
<p>This is <sup>paragraph</sup>.This has superscripted word.</p>
</body>
</html>

Output:

This isparagraph.This has superscripted word.