Re: Alignment property proposal

Alex Mogilevsky wrote:
> I'd like to add a few notes on "alignment" proposals:
> 
> First, I have mixed feelings on the goals of the new property. It appears to have multiple
> reasons to exist:
> 
> 1) Make it possible to model behavior of <CENTER>
> 2) Provide a more intuitive alternative to "margin:auto"
> 3) Enable alignment modes that are not possible in CSS2.1 ("true center", "vertical center")
> 
> ...
>
> The only advantage I see in standardizing a property that implements <CENTER> is that then it can
> be strictly defined and interoperable (and therefore the meaning of <CENTER> is consistent
> everywhere, which it isn't now).
>
> (2) sounds slightly more reasonable. "margin:auto" is not easily discoverable. However, if we
> expect authors to learn about margin collapsing, would it really help to add yet another way to
> center?
> 
> (3) is actually a good argument. But it doesn't have to be done with the same property that
> targets a deprecated HTML element.

Ok, that makes sense to me.

> Here is my thinking:
> 
> A. I like the approach of "text-align:block-center" (mentioned by Anne). I like it because
>   * text-align inherits (and <CENTER> needs inheritance)
>   * there is no issue of how 'text-align:left' interferes with 'block-align:center'
>   * the value can be defined as a precise equivalent of <CENTER>

I think your second point here is the most important.

> B. "true center" and vertical centering are great features to add.
>   * vertical-align already exists. Why not take same approach and define "vertical-align:block-middle"
>     which applies to everything, not just table cells?

If we're adding vertical block centering, we probably also want top/bottom
alignment as well. We could look at making vertical-align as a whole apply
to everything, or create a new property. I think it originally only applied
to table elements because there's a history there with valign and because
table layout is already a two-pass algorithm.

Anne also mentioned that the flexbox proposal might be able to do this. I
haven't looked at that yet.

>   * similarly, "text-align:true-center" and "vertical-align:true-middle" would give the
>     desired behavior without adding more properties to interfere with...

text-align shouldn't be affecting blocks. It should only be affecting inline
content. If we want a property for aligning blocks, it should be a separate
property. Aligning the block one way and the inline content another is very
common.

~fantasai

Received on Tuesday, 22 January 2008 18:58:13 UTC