HTML Formatting
HTML provides us with the ability for formatting text just like we do it in MS Word or any text editing software.
Example
<html>
<body>
<p><b>This is a bold text.</b></p>
<p><i>This is an italic text.</i></p>
<p>This is a <sub> subscript </sub> and <sup> superscript </sup> text.</p>
</body>
</html>
Try it »
HTML Formatting Elements
Formatting elements were designed to display special types of text:
- <b> - Bold text
- <strong> - Important text
- <i> - Italic text
- <em> - Emphasized text
- <mark> - Marked text
- <small> - Small text
- <del> - Deleted text
- <ins> - Inserted text
- <sub> - Subscript text
- <sup> - Superscript text
HTML <b> and <strong> Elements
- The HTML <b> elements defines bold text, without any extra importance.
- The HTML <strong> element defines strong text, with added semantic “strong” importance.
Example
<html>
<body>
<p>This text is normal.</p>
<p><b>This text is bold.</b></p>
<p><strong>This text is strong.</strong></p>
</body>
</html>
Try it »
HTML <i> and <em> Elements
- The HTML <i> elements defines italic text, without any extra importance.
- The HTML <em> element defines emphasized text, with added semantic importance..
Example
<html>
<body>
<p>This text is normal.</p>
<p><i>This text is italic.</i></p>
<p><em>This text is emphasized.</em></p>
</body>
</html>
Try it »
HTML <small> Elements
The HTML <small> elements defines smaller text.
Example
<html>
<body>
<h2>This is HTML <small> Small </small> Formatting.</h2>
</body>
</html>
Try it »
HTML <mark> Elements
The HTML <mark> elements defines marked/highlighted text.
Example
<html>
<body>
<h2>This is HTML <mark> Marked </mark> Formatting.</h2>
</body>
</html>
Try it »
HTML <del> Elements
The HTML <del> elements defines deleted/removed text.
Example
<html>
<body>
<p>The del element represents deleted or removed text.</p>
<p>My favourite colour is <del>yellow<del> black.</p>
</body>
</html>
Try it »
HTML <ins> Elements
The HTML <ins> elements defines inserted/added text.
Example
<html>
<body>
<p>The ins element represents inserted or added text.</p>
<p>My favourite <ins>colour</ins> is pink.</p>
</body>
</html>
Try it »
HTML <sub> Elements
The HTML <sub> elements defines subscripted text.
Example
<html>
<body>
<p>This is a <sub>subscripted</sub> text.</p>
</body>
</html>
Try it »
HTML <sup> Elements
The HTML <sup> elements defines superscripted text.
Example
<html>
<body>
<p>This is a <sup>superscripted</sup> text.</p>
</body>
</html>
Try it »