How to Underline Text in HTML

By eHow Internet Editor

Rate: (3 Ratings)

Underlines can be used to highlight and emphasize text on web pages. Text can be underlined using CSS style sheets, with the text-decoration property, or, less preferably, with the HTML U element.

Instructions

Difficulty: Easy

Things You’ll Need:

  • Text or HTML editor

Underline Text Using CSS

Step1
Find or enter the text you want to underline.
Step2
Place the text within a SPAN element, by adding an opening tag before the text and closing tag after.
Step3
Specify underlining of the text within the SPAN by adding a STYLE attribute to it as follows:
STYLE="text-decoration; underline; "
Step4
Add a CLASS attribute to the SPAN, giving the name of a CSS class which defines text underlining. This is an alternative to using the STYLE attribute as described in the preceding step. The format of the CSS class declaration is as follows:
.my-underlined-class { text-decoration: underline; }

Underline Text Using HTML

Step1
Find or enter the text you want to underline.
Step2
Enclose the text within a U element, by placing an opening and closing tag before and after the text.

Tips & Warnings

  • If you are using a WYSIWYG HTML editor, look for the underline menu item or toolbar icon to underline text without having to code CSS or HTML.
  • The CSS text-decoration property can also be used to place a line over (overline) or through (line-through text, or turn off underlining already in effect (none).
  • Remember that underlines are often used on web pages to indicate click-able links, so use underlines sparingly to avoid confusion.

Post a Comment

POST A COMMENT

Request a New How-To Article

Looking for more How To information? Chances are there’s an eHow member who knows how to do what you’re looking to do. Submit an article request now!

eHow Article:  How to Underline Text in HTML

eHow Internet Editor

eHow Internet Editor

Category: Internet

Articles: See my other articles

Related Ads

Internet

Veesites
Meet Virginia DeBolt eHow’s Internet Expert.