Re: [CSS21] percentage values of 'top'

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 UTC