Formatting is used for better look and feel. HTML provides the ability of formatting text just like you do it in MS Word or any text editing software. HTML provides us ability to format text without using CSS.
<b> element defines bold text, without any extra importance.
<strong> element defines text with strong importance.
The content inside <strong>…. <strong> element is typically displayed in bold.
The content inside <i>….. </i> element is typically displayed in italic.
<i> tag is often used to indicate a technical term, a phrase from another language, a thought, etc.
<em> element defines emphasized text. A screen reader will pronounce the words in
<em> with an emphasis, using verbal stress.
The content inside <em>….</em> is typically displayed in italic.
If you want to mark or highlight a text, you should write the content within <mark>………</mark> element.
If you want underlined text write anything within <u>………</u> element.
Anything written within <strike>…………………..</strike> element is displayed with strikethrough. It is a thin line which cross the statement.
It is used for Monospaced Font. Monospaced font provides similar space among every letter. In a monospaced font, each letter has the same width.
If you put the content within <sup>…………..</sup> element, is shown in superscript; means it is displayed half a character’s height above the other characters.
Superscript text can be used for footnotes, like WWW.
If you put the content within <sub>…………..</sub> element, is shown in subscript ; means it is displayed half a character’s height below the other characters.
Subscript text can be used for chemical formulas, like H2O
Anything written within <del>……….</del> element is displayed as deleted text.
<del> element defines text that has been deleted from a document.
Browsers will usually strike a line through deleted text.
Anything written within <ins>……….</ins> element is displayed as inserted text.
<ins> element defines a text that has been inserted into a document.
Browsers will usually underline inserted text.
<big> element defines larger text.
<small> element defines smaller text.
HTML Text Formatting Example
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>HTML Text Formatting Example</title> </head> <body> <p><b>This text is bold.</b></p> <p><strong>This text is important!</strong></p> <p><i>This text is italic.</i></p> <p><em>This text is emphasized.</em></p> <p><small>This is some smaller text.</small></p> <p><big>This is some larger text.</big></p> <p><mark>This is some marked text.</mark></p> <p><strike>This is some striked text.</strike></p> <p><tt>This is some Monospaced text.</tt></p> <p>This is <sup>sup</sup> text.</p> <p>This is <sub>sub</sub> text.</p> <p>This is <del>del</del> text.</p> <p>This is <ins>ins</ins> text.</p> </body> </html>