Text formatting
Text formatting is a means of changing it, such as selecting the font face and using effects that allow you to change the appearance of the text. In Table. 1 lists the main tags that are used to change the design of the text.
HTML Code | Description | Example |
---|---|---|
<B> Text </ b> | Bold text | Text |
<I> Text </ i> | Italic text | Text |
<Sup> Text </ sup> | Superscript | E = mc2 |
<Sub> Text </ sub> | Subscript | H 2 O |
<Pre> Text </ pre> | Text is written as 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 with each other. To make the text bold and italic at the same time, a combination of <B> and <I> tags is used (example 1). Their order in this case is not important.
Example 1. Bold italic text
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text / html; charset = windows-1251">
<Title> Text </ title>
</ Head>
<Body>
<P> <b> <i> "And where is the cookie and brewing?!" </ I> </ b> - exclaimed Malchish the bad guy. </ P>
</ Body>
</ Html>
The result of this example is shown in Fig. 1.
Fig. 1. Type of italic bold text
Using the <SUP> and <SUB> tags shifts the text relative to the baseline and reduces the font size. If you need to reduce the index, you can also add the <SMALL> tag (example 2).
Example 2. Creating a lower index
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text / html; charset = windows-1251">
<Title> Text </ title>
</ Head>
<Body>
<P> <b> Sulfuric acid formula: </ b> <i> H <sub> <small> 2 </ small> </ sub> SO <sub> <small> 4 </ small> </ sub> < / I> </ p>
</ Body>
</ Html>
The result of this example is shown in Fig. 2.
Fig. 2. The subscript in the text
The tags <STRONG> and <EM> perform the same functions as the <B> and <I> tags , but writing them is shorter, more familiar, and more convenient.
It should be noted that <B> and <STRONG> tags , as well as <I> and <EM>, are not exactly equivalent and replaceable. The first <B> tag is a physical markup tag and sets the bold text, and the <STRONG> tag is a logical markup tag and determines the importance of the tagged text. This separation of tags into logical and physical formatting was originally intended to make HTML universal, including that independent of the output device. Theoretically, if you use, for example, a speech browser, then the text created with the tags <B> and <STRONG> will be marked differently. However, it turned out that in popular browsers the result of using these tags is equivalent.
Copyright © www.htmlbook.ru
Comments
When commenting on, remember that the content and tone of your message can hurt the feelings of real people, show respect and tolerance to your interlocutors even if you do not share their opinion, your behavior in the conditions of freedom of expression and anonymity provided by the Internet, changes Not only virtual, but also the real world. All comments are hidden from the index, spam is controlled.