HTML - Formatting




HTML Formatting

To provide a better look and feel, the text/paragraph need to be formatted; for example, making text bold, underline, or italic.

Following are the major options of formatting the text in HTML −

Bold Text

<p><b>Write the Paragraph in bold text.</b></p>

Example

<!DOCTYPE html>
<html>
<body>
<p>This paragraph is normal.</p>
<p><b>This paragraph is bold.</b></p>
</body>
</html>

Result

This paragraph is normal.

This paragraph is bold.

Italic Text

<p><i>Write the Paragraph in italic text.</i></p>

Example

<!DOCTYPE html>
<html>
<body>
<p>Write the <i>Paragraph</i> in italic text.</p>
</body>
</html>

Result

Write the Paragraph in italic text.

Underline Text

<p><u>Write the Paragraph in underlined text.</u></p>

Example

<!DOCTYPE html>
<html>
<body>
<p>My Paragraph <u>underlined</u>.</p>
</body>
</html>

Result

My Paragraph underlined.

Strike Text

<p> <strike> Write the Paragraph with strikethrough </strike></p>

Example

<!DOCTYPE html>
<html>
<body>
<p>This Paragraph <strike> scratched</strike> out!</p>
<p>This Paragraph no scratched</p>
</body>
</html>

Result

This Paragraph scratched out!

This Paragraph no scratched

Subscript Text

<p> <sub> Write the Paragraph in subscript </sub> </p>

Example

<!DOCTYPE html>
<html>
<body>
<p>Testing <sub>subscript text</sub></p>
<p>Testing <sup>superscript text</sup></p>
</body>
</html>

Result

Testing subscript text

Testing superscript text

Superscript Text

<p> <sup> Write the Paragraph in superscript</sup> </p>

Example

<!DOCTYPE html>
<html>
<body>
<p>Testing <sub>subscript text</sub></p>
<p>Testing <sup>superscript text</sup></p>
</body>
</html>

Result

Testing subscript text

Testing superscript text

Inserted Text

<p> <del> Delete the paragraph </del> <ins>insert paragraph</ins> </p>

Example

<!DOCTYPE html> 
<html> 
<body> 
<p> My favorite color is <del> MediumSeaGreen</del>  <ins> red</ins> !</p> 
</body> 
</html> 

Result

My favorite color is MediumSeaGreen red!

Deleted Text

<p> <del> Delete the second paragraph </del> </p>

Example

<!DOCTYPE html>
<html>
<body>
<p>This is my favorite color <del>Brown</del> <ins>Crimson</ins>!</p>
</body>
</html>

Result

This is my favorite color Brown Crimson!

Smaller Text

<p> <small> Write the first paragraph in smaller font </small> </p>

Example

<!DOCTYPE html>
<html>
<body>
<p>Htmltpoint.com - is a dedicated website to provide quality online education in the domains of Computer Science, Information Technology, Programming Languages,</p>
<p><small>Copyright 2017-2018 by Refsnes Data.</small></p>
</body>
</html>

Result

Htmltpoint.com - is a dedicated website to provide quality online education in the domains of Computer Science, Information Technology, Programming Languages,

Copyright 2017-2018 by Refsnes Data.