How to Underline Text in HTML

By Steve McDonnell

While you can underline text in HTML by enclosing the text in the tag -- for example, "this text is underlined" -- the preferred approach is to create a cascading style sheet, define a style element and apply the element to the text you want to underline. For example, place the following CSS between thetags:and place the following between the HTMLtags: this text is underlined.

Common Conventions for Emphasizing Text

In HTML5, the tag should be used to label proper Chinese names and to indicate misspelled words. Since underlined text typically signifies a hyperlink on a Web page, you should use a different attribute, such as boldface or italics, to emphasize text. When you use a cascading style sheet to define the style for emphasized text, you need only change a single style element to automatically convert all underlined text to boldface or italics. For example, change the previous CSS style element definition to ".emphasis { font-weight:bold;}" or ".emphasis { font-style:italic; }" (no quotes).