W3C home > Mailing lists > Public > www-style@w3.org > July 1999

Re: <U> Deprecated

From: Steven Pemberton <Steven.Pemberton@cwi.nl>
Date: Tue, 20 Jul 1999 13:28:34 +0200 (MET DST)
To: David Shaw <davids@nwi.net>
Cc: "'www-style'" <www-style@w3.org>
Message-ID: <14228.22725.566230.597832@schoener.cwi.nl>
 > I know that in HTML4.x Underline <U> is deprecated.
 > So, I ask you, how would  I be expected to underline a word in a 
 > sentance using CSS? Or an in-line style parameter?

The idea behind using style sheets is to separate content from
presentation. So don't ask yourself "how do I underline?", first ask
"what am I trying to represent?".

If the answer is "defining instances of a word" then code your HTML
like this:

	A <span class="define">programmer</span> is a device for
	turning coffee into programs.

If you are underlining a sentence because it is important, classify it 
that way:

	<span class="important">Don't mention the war!</span>

and so on.

Then use those classes in your style sheet:

	.important {text-decoration: underline}
	.define {text-decoration: underline}

This has a number of advantages:

	* If you change your mind about how it should look, you only
	  have to change one place in your files
	* You separate the different uses of underlining so that you
	  can later distinguish between them
	* The sight impaired can still understand what you are trying
	  to represent in your HTML.

By the way, some people prefer to use <strong> or <em> instead of
<span> since the words then still show up differently on CSS
deficient browsers.

Steven Pemberton
Received on Tuesday, 20 July 1999 07:28:39 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:50 UTC