W3C home > Mailing lists > Public > www-style@w3.org > April 2011

Re: [css3-text] Underlines match the color of the text (was Allow control of text-decoration width

From: Aryeh Gregor <Simetrical+w3c@gmail.com>
Date: Fri, 8 Apr 2011 17:36:39 -0400
Message-ID: <BANLkTinrOXn9WriLtwMRVVuh+oBTbj9zGg@mail.gmail.com>
To: "Eric A. Meyer" <eric@meyerweb.com>, Cameron McCormack <cam@mcc.id.au>
Cc: www-style@w3.org
On Fri, Apr 8, 2011 at 5:05 PM, Eric A. Meyer <eric@meyerweb.com> wrote:
>   Here's a current workaround:
>
>     * {text-decoration: inherit;}
>
> WARNING: this may have unintended consequences in scenarios I haven't
> envisioned, and it can't really cover cases where a child has a decoration
> different than its parent's decoration and you want both decorations in the
> child's area to be the same color as the child.
>   Still, it should cause any element with a parent that's been
> text-decorated to copy the decoration onto itself, and thus set the color of
> its new self-decoration to its own color.

Well, this clearly doesn't work if you mix different types of
decoration.  But even if you stick to only underlines, say, it will
cause awfully funny-looking results in some cases in at least some
browsers.  What you're telling the browser is to draw a new underline
on top of any existing ones for every new element, but that will only
work if the new underline has the same position and thickness as the
old.  So for instance,

data:text/html,<!doctype html>
<style>
* { text-decoration:inherit }
body { font-size: 3em }
</style>
<span style=text-decoration:underline>Abc <sup>def</sup> ghi</span>

looks very wrong in Firefox 4.0, Chrome 12 dev, and Opera 11 (although
it looks great in IE9).  Actually, WebKit is obviously just ignoring
the spec here, because it draws only one underline instead of two
under "def".

Clever idea, though.

On Fri, Apr 8, 2011 at 5:18 PM, Cameron McCormack <cam@mcc.id.au> wrote:
> FWIW, we use this pattern deliberately for element links in SVG
> specifications, e.g. see the ‘ellipse’ words here:
>
>  http://www.w3.org/TR/SVG/shapes.html#InterfaceSVGEllipseElement
>
> (I don’t claim that it’s a particularly nice style, just that some
> people are relying on it.)

You use it deliberately as in you want the effect because you think it
looks nice, or because that's the way it accidentally happened to look
when someone first wrote the spec however many years ago and nobody
noticed for a while and then you got used to it and prefer it ex post
facto?  Not that the latter is invalid, I'm just wondering.
Received on Friday, 8 April 2011 21:37:26 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:39 GMT