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

Re: [css21] computed value of top/bottom for relative positioning

From: Anton Prowse <prowse@moonhenge.net>
Date: Thu, 12 Feb 2009 21:36:05 +0100
Message-ID: <49948835.20807@moonhenge.net>
To: www-style@w3.org

Anne van Kesteren wrote:
> Given the following tree:
>   G
>     P
>       C
> ... with the following styles:
>   G { height:100px }
>   P { position:relative; bottom:25%; height:0 }
>   C { position:relative; bottom:inherit }
> http://www.w3.org/TR/CSS21/visuren.html#position-props states that for a 
> relative positionined element the computed value of 'bottom' (which is 
> also the inherited value) is defined in 
> http://www.w3.org/TR/CSS21/visuren.html#relative-positioning However, 
> that section states that the computed value of 'top' will be -bottom 
> (i.e. -25%) because 'top' is auto (initial value), but it does not state 
> what the computed value of 'bottom' is in that case, which makes it 
> unclear what 'bottom' for element C means (i.e. is it 25% (leads to 0 
> here) or 25px). The releative positioning section should probably be 
> more clear on what the computed value is here unless I'm missing something.

Nice puzzle!  I don't think you're missing anything, and I suppose it 
depends on what the philosophy of computed values is.  Do specified 
percentages normally remain as percentages for the purposes of the 
computed value?  It feels to me that they are more interesting that way, 
in general.  Certainly, the computed value of 'bottom' would be 25% if P 
were neither statically nor relatively positioned, according to 
http://www.w3.org/TR/CSS21/visuren.html#position-props (9.3.2 Box 
offsets) despite the fact that a pixel value could be calculated at the 
time of determining computed values.

http://www.w3.org/TR/CSS21/visuren.html#relative-positioning (9.4.3 
Relative positioning) is too careless in its existing wording: compare 
"the computed values are always: top = -bottom" to "If 'left' is 'auto', 
its computed value is minus the value of 'right'" (where one supposes 
that 'the value of right' means 'the specified value of right').  One 
presumes that the horizontal and vertical situations are supposed to be 
analogous, in which case the result of "merging" the two statements is 
that percentages are acceptable as computed values for all four 
properties in the case of relative positioning.

However, if the latter statement I quoted is not accurate and should 
instead read "If 'left' is 'auto', its computed value is minus the 
/computed/ value of 'right'", then 9.4.3 provides no guidance at all as 
to how to calculate computed values from specified percentages for these 
four properties.

Anton Prowse
Received on Thursday, 12 February 2009 20:36:54 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:24 UTC