W3C home > Mailing lists > Public > www-style@w3.org > September 2001

% heights on Absolutely Positioned elements

From: ValerieGSharp <ValerieGSharp@netscapeonline.co.uk>
Date: Thu, 27 Sep 2001 19:27:56 +0100
Message-ID: <3BB36FAC.3BAE56DF@netscapeonline.co.uk>
To: "www-style@w3.org" <www-style@w3.org>
[Note: Discussing primarily percentage heights for abs pos elements, but
the same is true for percentage offsets on these elements.]


CSS2 "10.5 Content height: the 'height' property"[1]:

  "<percentage> 
           Specifies a percentage height. The percentage is calculated
with respect to the height of the generated box's containing block. If
the height of the containing block is not specified explicitly (i.e., it
depends on content height), the value is interpreted like 'auto'."


and:

CSS3 Box Model(WD) "9.1. The <length> and <percentage> values"[2]:

  "A <percentage> is relative to the computed value of the width or
height of the containing block, but if that value is 'auto' the computed
value for the percentage is also 'auto'."


Current browser behaviour seems to follow this, except in the case
Absolutely Positioned elements, where percentages for 'height' (and,
similarly, offsets) _are_ used.


It seems reasonable to suppose that if the height of the containing
block is 'auto' and depends on the content of the current element, then
the situation of calculating the height of an element as, in effect, a
percentage of its own content should be avoided.

But given that an absolutely positioned element is taken out of normal
flow so its content does not contribute to the height of its
containing block, then, with an 'auto' height of the containing block
being determined independently, it seems reasonable for percentages to
be effective.


Perhaps CSS2 "10.5 Content height: the 'height' property"[1] could state
something like:

  "<percentage> 
           Specifies a percentage height. The percentage is calculated
with respect to the height of the generated box's containing block. If
the element is in normal flow (or floated?[3]) and the height of the
containing block is 'auto' (i.e., it depends on content height), the
value is interpreted like 'auto'."



[1]http://www.w3.org/TR/REC-CSS2/visudet.html#propdef-height

[2]http://www.w3.org/TR/2001/WD-css3-box-20010726

[3]CSS3 Box Model(WD) "9.2. The 'auto' value"[2]:

  "[Need to explain that 'height: auto' in horizontal flow (and 'width:
auto' in vertical flow) is the intrinsic height (or width). Probably
need to specify that the height of a flow root (but not of other
elements) includes any floating (and positioned?) descendants in that
flow. This is so that a float descendant of another float remains
visually inside the latter float.]"



-- 
Regards,
Val Sharp - Edinburgh
Received on Thursday, 27 September 2001 14:34:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:10 GMT