W3C home > Mailing lists > Public > www-style@w3.org > January 2012

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

From: Jon Rimmer <jon.rimmer@gmail.com>
Date: Thu, 5 Jan 2012 12:38:09 +0000
Message-ID: <CA+ZDCiA5-Yn5xeOw1q6YsxBB32KEzXFT-p4GpTF4Tt3b9chKjg@mail.gmail.com>
To: mail@matthewwilcox.com
Cc: www-style@w3.org
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.



[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

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