Re: [css3-text] better way to do forced last-line justification

On 11/27/12 11:15 PM, "John Daggett" <jdaggett@mozilla.com> wrote:

>
>The CSS3 Text spec includes a new 'text-align-last' property for
>controlling alignment on the last line of a paragraph for example. [1]
>There isn't an example in the spec, but I'm guessing the use case is
>something like this:
>
>  p {
>    text-align: justify;
>    text-align-last: left;
>  }
>
>This way if the last line contains just two words they aren't spread
>across the page.
>
>But using a new property for this seems like overkill, there seem to
>be lots of combinations that have no real use case.
>
>  p {
>    text-align: justify;
>    text-align-last: center;
>  }

I actually prefer this setting to text-align:center in some cases where
you want a visual centering without so many ragged line edges. This does
get used in figure captions where a single-line caption is centered but a
multi-line caption has lines justified to the figure width, and the last
line centered.

>
>I think it might be better to add an additional keyword to the
>'text-align' property instead.  Since forcing full justification on
>the last line is rarely desirable, I would propose a 'force-last'
>keyword that explicitly forces full justification on the last line:
>
>  p {
>    text-align: justify force-end;
>  }
>
>Without the keyword, last line alignment would be based on the
>direction.  This seems like a more natural way of spec'ing this.
>
>Cheers,
>
>John Daggett
>
>[1] http://dev.w3.org/csswg/css3-text/#text-align-last
>
>

Received on Wednesday, 28 November 2012 12:53:15 UTC