The HTML Text Formatting refers to the HTML elements that are designed specially for formatting content in an HTML document.
Syntax
Following is the syntax −
<tagname>content</tagname>
Following are the text formatting tags in HTML:
Sr.No. | Tag & Explanation |
---|---|
1 | <b> It specifies bold text in an HTML document. |
2 | <em> It specifies emphasized text in an HTML document |
3 | <i> It specifies italic text in an HTML document. |
4 | <small> It specifies smaller text in an HTML document. |
5 | <strong> It specifies important text in an HTML document. |
6 | <sub> It specifies subscripted text in an HTML document. |
7 | <sup> It specifies superscripted text in an HTML document |
8 | <ins> It specifies inserted text in an HTML document. |
9 | <del> It specifies deleted text in an HTML document. |
10 | <mark> It specifies highlighted text in an HTML document. |
Let us see an example of HTML Text Formatting:
Example
<!DOCTYPE html> <html> <style> body { color: #000; height: 100vh; background-color: #8BC6EC; background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%); text-align: center; } </style> <body> <h1>HTML Text Formatting Demo</h1> <b>I'm Bold Tag</b> <br> <em>I'm Em Tag</em> <br> <i>I'm I Tag</i> <br> <small>I'm Small Tag</small> <br> <strong>I'm Strong Tag</strong> <br> <sub>I'm Sub Tag</sub> <br> <sup>I'm Sup Tag</sup> <br> <ins>I'm Ins Tag</ins> <br> <del>I'm Del Tag</del> <br> <mark>I'm Mark Tag</mark> <br> </body> </html>