W3C home > Mailing lists > Public > www-style@w3.org > June 2009

Re: [CSS21] percentage values of 'top'

From: Jorrit Vermeiren <mercator+w3c@gmail.com>
Date: Fri, 5 Jun 2009 16:58:16 +0200
Message-ID: <bd6e15d00906050758y4026b448maeb847e76d5ca85f@mail.gmail.com>
To: Anton Prowse <prowse@moonhenge.net>
Cc: "www-style@w3.org" <www-style@w3.org>
On Thu, Jun 4, 2009 at 16:22, Anton Prowse<prowse@moonhenge.net> wrote:
> CSS21 doesn't seem to permit ignoring the top:-50% here.  Percentage values
> for 'top' refer to height of containing block, which, for static or
> relatively positioned elements, is formed by the content edge of the nearest
> block-level, table cell or inline-block ancestor box.  It seems to me that
> UAs should be able to know what the height of div.inner is (despite it
> depending upon the height of its child p) and be able to honour top:x% on
> the child p.
>
> Am I misunderstanding the specified behaviour or underestimating the
> difficulty of implementing it?

It looks like this behaviour is "just" a vestige of CSS2. That says
the following about percentage values: "For 'top' and 'bottom', if the
height of the containing block is not specified explicitly (i.e., it
depends on content height), the percentage value is interpreted like
'auto'." [1]

Setting a height on div.inner [2] makes the positioning "work" again
(it doesn't center unless the height for div.inner is the same as the
height of its child p).

Jorrit


[1] http://www.w3.org/TR/2008/REC-CSS2-20080411/visuren.html#position-props
[2] http://lists.w3.org/Archives/Public/www-style/2009Jun/0056.html
Received on Friday, 5 June 2009 14:58:53 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:18 GMT