W3C home > Mailing lists > Public > public-html@w3.org > December 2007

Re: Underline element.

From: Matt Wilcox <elvendil@gmail.com>
Date: Thu, 27 Dec 2007 13:08:22 +0000
Message-ID: <4773A3C6.6000004@gmail.com>
To: Ivan Enderlin <w3c@hoa-project.net>
CC: public-html@w3c.org
You can, but <u> is presentational mark-up, and there shouldn't be 
presentational mark-up in HTML.
Use CSS to achieve the underline as follows:

<p>This is a paragraph and <em>this is emphasised</em></p>

em { text-decoration : underline; }

Or, if the text you wish to underline has no semantic difference to the 
text around it (i.e., is purely decorational) use something like this:

<p>Here is a meaningless corporate <span>style</span></p>

span { text-decoration : underline; }



Regards,
Matt

Ivan Enderlin wrote:
> Hi all :)
>
> I was reading the HTML 5 draft and something is strange about <u> tag.
> In HTML 4, <u> tag is depreciated [1], and <u> tag doesn't exist in 
> HTML 5 [2]. I don't find anymore informations about it in XHTML 1.0 or 
> 1.1. So I deduce that we can't underlined an element in HTML right now ?
>
> Best regards,
> -Ivan
>
> Notes :
>     [1] http://www.w3.org/TR/html4/present/graphics.html#edef-U ;
>     [2] http://www.whatwg.org/specs/web-apps/current-work/#phrase.
Received on Friday, 28 December 2007 17:33:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:11 GMT