HTML Underline - CSS Tips

An HTML underline typically indicates a link in Web design. However, there may be times when you want to use HTML underline, or other HTML codes, to spice up your Web site and draw attention to certain text.

HTML Underline Code
The HTML underline code is <u>text you want to underline here</u>. You always need the brackets to enclose HTML coding, so that browsers know the enclosed text is HTML code. A slash is used in the end bracket to close HTML codes. Without that slash, every word would be underlined.

Should You Underline?
It's generally accepted among Web designers that you never want to underline text on a Web page. This is because underlined text typically indicates a link. If you underline text on a Web page, most users are going to assume they can click the text to go to another page. They may be annoyed or think your page is defective if clicking doesn't work. Use bold or italics codes to emphasize text without misleading visitors.

HTML Bold Code
The HTML code to bold text on a website is <b>text you want to bold here</b>. Note that like the underline text, the bold code is enclosed in brackets, and the end code has a / to denote that it is the end of the bolded section. If you forget to put the / in the end tag, the rest of the text on the page is bolded.

HTML Italics Code
The HTML code to italicize text on a website is <i>text you want to italicize here</i>. Again, enclose the tags in brackets and always include an end tag. Italics may be more difficult to view in some fonts, so it's not as versatile as bold text.

HTML Link Code
The HTML code to create a link on a Web page is <a href="http://yourlinkhere">link text</a>. This is an example of an attribute code that contains additional display or functional information for a Web browser. The name of the attribute is "a href," and the value is enclosed in quotation marks. Like all HTML codes, you need a slash in the end tag to denote the end of the link.

Using CSS
There are alternate ways of coding underlines, bold and italic text in CSS. 

  • For italics, use <em>yourtext</em>
  • For bold, use <strong>yourtext</strong>
  • For underlining, use the attribute text-decoration: underline (this attribute can appear in line with the text, or as part of a global style sheet)

Using CSS with properly coded HTML can save time and improve the appearance of your pages. Newer Web browsers are optimized for CSS and use built-in text rendering features to make things more readable. If you're getting bad results with standard bold or italics in HTML, try using the CSS equivalents.

Related Life123 Articles

You hear the phrase all the time, but what does HTML stand for? Find out how this simple code makes the Internet work.

You can learn how to write HTML simply by mastering a few tags.

Frequently Asked Questions on
More Related Life123 Articles

What does HTML mean anymore? With the advent of multiple alternative Web programming languages, is HTML still relevant?

A simple set of tags helps to answer the question, "How does HTML work?"

Ask most people, "What is HTML?" and they'll tell you it's a language for page design. In reality, this is far from the truth.

© 2015 Life123, Inc. All rights reserved. An IAC Company