Formatting text in HTML

Text formatting - different means to edit text, as for example - choosing font style and usage of effects that allow you to change the text. Table 1 shows the basic tags that are used to customize the text.
Table 1. Their order in this case is not important.
HTML code | Description | Example |
---|---|---|
<b>Text</b> | Bold text | Text |
<i>Text</i> | Italic text | Text |
<sup>Text</sup> | Superscript | e=mc² |
<sub>Text</sub> | Subscript | H2O |
<pre>Text</pre> | The text is written as it is, including all spaces | Text |
<em>Text</em> | Italic text | Text |
<strong>Text</strong> | Bold text | Text |
Any text formatting tags can be used together. To make the text bold and italic, use combination of tags b and i (example 1). Their order in this case is not important.
Example 1. Bold italic text.
<b><i>"And where are my cookies?!"</i></b> - A naughty boy cried.
Using tags sup and sub shifts the text relative to the baseline and reduces the size of the font. If you need to make the size even smaller, you can add the tag small (example 2).
Example 2. Creating subscript.
<b>Sulfuric acid formula:</b> <i>H<sub><small>2</small></sub>SO<sub><small>4</small></sub></i>
Tags strong and em perform the same functions as tags b and i, but they are less long, more familiar and easy-to-use.
It should be noted that the tags b and strong, i and em are not exactly equivalent and interchangeable. Tag b - is a tag of physical markup and sets bold text, whereas the tag strong - is a tag of logical markup and indicates the importance of the marked text. Such a division of tags on logical and physical was originally designed to make the HTML language universal, including for the language to be independent of the output device. Theoretically, if we use, for example, voice browser, a text, changed by tags b and strong, will be shown in differently. However, as it turns out that in popular browsers the result of using these tags is equivalent.