W3C home > Mailing lists > Public > www-style@w3.org > June 2013

[css-text] text-align-last and cascading

From: fantasai <fantasai.lists@inkedblade.net>
Date: Fri, 14 Jun 2013 18:56:18 +0900
Message-ID: <51BAE8C2.7040900@inkedblade.net>
To: "www-style@w3.org" <www-style@w3.org>, Simon Montagu <smontagu@smontagu.org>
There was an open issue on whether 'text-align-last' has an effect
when 'text-align: justify' or not. IIRC in IE, it only works when
'text-align: justify', whereas in Gecko it works any time.

Thinking about this, I noticed we have this problem:

   p {
     text-align: justify;
     text-align-last: justify;

   p.special {
     text-align: center;
     /* last line will be justified!? */

Having the two properties be independent creates this cascading problem.
IE dealt with it by only triggering on 'text-align: justify'.

An alternate way to deal with it is by making 'text-align' a shorthand
of 'text-align-last'. This has a few benefits:

   1. Solves cascading problem 100%, even for more complex
      cases that involve a return to 'text-align: justify'.

   2. Allows nice shorthanding of common case with e.g.
        text-align: justify-all;

   3. Behaves the way authors would expect given 'text-align' is a
      prefix of 'text-align-last'.

There's one problem: backwards-compat. As long as existing documents
predominantly use the order
   text-align: justify;
   text-align-last: <whatever>;
they will continue to work. But if there are significant cases that use
   text-align-last: <whatever>;
   text-align: justify;
those will break.

Full proposal would be:

   text-align: <alignment-values>{1,2} | justify-all;
   -> text-align-all: <alignment-values>;
   -> text-align-last: auto | <alignment-values>;

   (Alternatively, in this level, we could only allow a single position
   instead of two.)

   The poetry use case that currently uses two values
     text-align: start end; /* start-align first line, end-align rest */
   would become
     text-align: start-first end;
   which is probably more understandable anyway. Or we could defer it
   to L4 in case we want to consider a 'text-align-first' property

Thoughts? Particularly from IE folks?

Received on Friday, 14 June 2013 09:56:47 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:31 UTC