> I don't quite understand. This is a new rule for laying out some content.
> And anything inside element with this property, this rule will apply for
Horizontal and vertical layout processing isn't symmetrical, even after
your proposal. That's fairly obvious from the contortions CSS 3 drafts
go to to handle vertical text. For horizontal text, height is the
free variable and width is constrained.
To centre horizontally, one must either specify defined margins and
paddings, or specify a defined width, and for text, the normal way is
to specify a defined width, in which case, one centres by using margin:
auto for both left and right margins. The result is that any border
lies within the blank area as far as horizontal centering is concerned.
Your proposal for vertical centering uses, for want of a better word,
filling, within the padding. That means that the border lies outside
of the blank area for vertical centering. Overall, the result is
a narrow in width and tall in height border.
More generally, I suspect the reasons for allowing vertical centering
mechanisms on table cells and absolutely positioned objects are that:
- used properly, for table, not grid layouts, table cells are normally
small in height;
- normally if one wants vertically centred material in other contexts,
one is controlling the layout to an extent that would require
absolution positioning anyway.
In other circumstances, incremental rendering takes precedence.
In any case, it has been pointed out that CSS3 allows the generation of
pseudo elements that can be used to represent the area into which the
material in question is being centered, so there is no need for new
constructs and no need for adding real elements for purely presentational
purposes. I would have agreed that adding div's purely to achieve centering
would be a mixing of structure and presentation, but that is not necessary