Re: We can't center vertically if we don't know the height of the box and container

On 5 January 2012 11:40, Matthew Wilcox <elvendil@gmail.com> wrote:
> Is this being looked at?
>
> To quote from a blog post I wrote on the topic recently:
>
> For the love of all that is good in the world, I can not see why this
> is still a problem in CSS. We get hardware-accelerated CSS filters,
> but we still can’t get a box to centre vertically if we don’t know the
> box height and container height. Evidently no designers want to do
> that or no cows have wandered down that path, or all the one’s that
> did walked off a cliff and were never heard of by the CSS-WG. You
> might expect vertical-align:middle; to work. Well, don’t we all.
> *crickets*
>
> There’s a hack to do it, but the problem with using display:table is
> that accessible agents derive a semantic meaning from the CSS
> declaration and read it out as a table. Yes, I agree that sounds
> pretty backward to me too, but that’s what happens. Which means the
> hack is harmful to accessibility. Why the CSS-WG don’t just allow
> vertical-align:middle; on non-cell properties I don’t know.
>
> So, now I ballsed up and joined the list - can someone please explain
> this, and can we fix it?
>

Hi Matt,

This is indeed a frustrating issue, but fortunately it is being
addressed. I suggest looking at Flexible Box Model[1] and Grid
Layout[2], which will provide a way to achieve more complex layouts
using CSS, including easy vertical centering of blocks.

Thanks,

Jon

[1] http://www.w3.org/TR/css3-flexbox/
[2] http://www.w3.org/TR/css3-grid-layout/

Received on Thursday, 5 January 2012 12:38:38 UTC