HTML Code for Underlined Italics
Formatting text in HTML requires an understanding of how HTML tags work. HTML tags are not seen by the user, but they format the text and how it functions in a user-read document. Also, multiple tags can surround any given text to denote necessary formatting properties. With proper HTML tag usage, textual design (such as underlining, italics, bolding and hyperlinking) becomes a matter of simply knowing which tags to use -- and when.
-
HTML Tag <u>
-
Typically, the only text that is underlined in a Web document are hyperlinks. Because of this, the practice of underlining text is deprecated in standardized Web design in order to avoid confusion. The designer may want to underline text despite this. In this case, surrounding text with the <u> tags will underline all the contained text when displayed in a browser. For example, the HTML
<u> Hello! </u>
will display the word "Hello!" underlined in a web browser.
HTML Tag <i>
-
Rendering text as italicized is a matter of surrounding the text with the right tags, similar to the underline tag (<u>). In this case, the <i> tag denotes text formatted with italics. For example,
<i>Italicized</i>
Will render the word "Italicized" in italics.
-
HTML Tag <em>
-
Another way to render italics is with the <em> tag. The "em" stands for "emphasis," as in "this text is important and should be emphasized." But the <em> tag is a little different. While the following HTML text,
<em>Italicized</em>
will normally appear identical to text surrounded with the <i> tag, the <em> tag is meant as a descriptive marker. That is, if a browser (Chrome, for example) decides to render "important" text differently than Firefox, then the text will appear different between the two browsers.
Nesting Tags
-
To bring these together, the tags must be nested around text. Browsers parse standard HTML by reading opening tags in order, and then looking for the corresponding closing tags (those with backslashes) in reverse order. To italicize and underline a text, look at this example:
<i><u>Hello!</u></i>
The order of the tags in this example is not important. What is important is that the closing tags follow a specific order: <u> is the last tag before the text "Hello!" and must be the first tag closed with </u>. Then <i> can be closed with </i>. This will render an italicized, underlined text.
-
References
- Photo Credit Comstock/Comstock/Getty Images