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

[css3-text] Splitting up text-decoration into orthogonal properties

From: Aryeh Gregor <Simetrical+w3c@gmail.com>
Date: Fri, 25 Mar 2011 17:00:30 -0400
Message-ID: <AANLkTik7OUQrF5AdKkgFx2RZGaERPj5QShiZ6j92f3Pw@mail.gmail.com>
To: www-style@w3.org
CSS 2.1 defines a single text-decoration property, which can be used
to set underline, line-through, overline, and blink.  A consequence of
the way it's defined is that you can't set one of these without
resetting the others.  If I wanted a rule like

.important {
    font-weight: bold;
    color: red;
    text-decoration: blink;

then <u class="important"> would no longer be underlined.

In practice this isn't a huge issue, because no one honestly uses any
of these much other than underline.  However, since CSS 3 Text is
making text-decoration a shorthand property anyway, it should take the
opportunity to let authors set the various types of decoration
separately.  border is a good model for this -- it's really a
shorthand for border-top, border-right, border-bottom, and border-left
in the case that you want them all the same, and each of those is a
shorthand for border-*-width, border-*-color, and border-*-style.

So instead of having text-decoration be a shorthand for
text-decoration-line, text-decoration-color, and
text-decoration-style, instead have it be a shorthand for
text-underline, text-line-through, text-overline, and text-blink.
Then text-underline can be a shorthand for text-underline-style (which
should accept an extra "none" keyword, like border-*-style),
text-underline-color, and text-underline-cancel, and likewise for
text-line-through and text-overline.  text-blink would just take
"blink" and "none" as its properties.  As an added bonus, this would
allow specifying different styles and colors for different decorations
on the same element.

As with my last comment here on text-decoration, the way things are
currently set up is causing issues for me when speccing execCommand().
 I want to be able to set a specific property to create an underline,
without having to worry about unsetting other properties while I do
it.  text-decoration is the only property that's causing me problems.
If this change isn't made, I'll have to hack around it by defining
fake CSS properties and defining execCommand()-specific algorithms to
get and set them in terms of text-decoration.

(By the way, I notice text-decoration-line now includes cancel-
values, which were added in 1.168:
Received on Friday, 25 March 2011 21:01:23 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:44 UTC