HTML— Text Formatting/Styling
HTML provides us with a very basic styling of text. Here are some of them:
- Bold
The first way to do that is using the <b></b> tag which is used for bold.
<b> tag is fine to use but a better (second way) way to make a text bold is by using the <strong> tag which is the same as the <b> tag.
<b>This is bold text.</b>
<strong>This is also bold text.</strong>
- Italic or Tilted
To make text italic use tag <i> or a better way is by using <em> tag which is short for emphasis. Both give us the same results.
<i>This is italic text.</i>
<em>This is also italic text.</em>
- Underlined
We use the <u> tag for underlining text but a better way to do this is by using the <ins> tag short for inserted. Again same results.
<u>This is underlined text.</u>
<ins>This is also underlined text.</ins>
- Superscript (Above the line)
To make text superscript, we use the <sup> tag.
This is <sup>superscript</sup> text.
- Subscript (Below the line)
To make text subscript, we use the <sub> tag.
This is <sub>subscript</sub> text.
- Deleted or Cut
We use <del> tag to get deleted text. We also see a <strike> tag on some websites. Strike tag is not used in HTML 5
<del>This is some deleted text.</del>
<strike>This is also deleted text.</strike>
Last, this is not text styling but we see in some websites a horizontal line that divides the website into sections. To add such a line we use the <hr> tag which is short for Horizontal Row.
You can find more text formatting by just googling “Text formatting in HTML”.
Instructor ~ TARUN KUMAR