KBD

Keith Devens .com

Friday, December 5, 2008 Flag waving
Would that which we have achieved have been possible if Providence had not helped us? – Adolf Hitler (in a speech at Regensburg on June 6th, 1937)
← RSSRuby makes me feel good →

Daily link icon Friday, June 7, 2002

CSS3 Box Model concern

As a followup to my discovery of what I believe is an error in the CSS box model, I've sent an e-mail to the editor of the CSS3 box model specification, reproduced below:

----- Original Message -----
From: "Keith Devens"
To: <bert @ w3 .org>
Sent: Friday, June 07, 2002 12:02 AM
Subject: CSS3 Box Model concern

Dear Mr. Bos:

Please forgive me if you're not the appropriate person to send these
comments to.

I have concerns about one aspect of the CSS3 box model. Specifically, how
the height of a box is computed when its height is specified in percentages
and the containing box's height is "auto". The specific verbiage in CSS3 [1]
is this:

"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'."

and in CSS2 [2]:

"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'."

After trying very hard to create a specific layout and speaking to some
folks on #mozillazine, I've come to believe, and those I spoke to in
#mozillazine agreed, that this is an error in the spec [3]. This one error
makes it impossible to produce many layouts with CSS that are otherwise
achievable using tables, and I give an example of this in [3].

I believe a better approach would be to always have a percentage height be
calculated relative to the computed value of the containing box, rather
than "resetting" a specified percentage value back to 'auto' if the
containing box isn't given a fixed height. My only conjecture as to why the
spec was written this way was because of a concern about implementation
difficulty. I don't believe this is an issue, however, because the layout
calculations performed if percentage values were computed according to the
containing box's computed height are similar to other calculations the user
agent already has to perform in other areas of layout, specifically, with
tables. Those I spoke to in #mozillazine also agreed that this would not be
an implementation concern.

Furthermore, even though it would break strict compatibility with CSS2 if
this were changed in CSS3, the real effect would be negligible. This is
because specifying a percentage height on an element contained within a box
without a fixed height is currently meaningless in CSS2 and in the current
working draft of CSS3. Therefore, if the spec allowed percentage heights to
be computed according to the computed height of a containing box, the spec
would take away no existing capabilities, and would add a significant new
capability. Moreover, that change would remove a special case currently put
into the spec, and would make height calculations more consistent, more
intuitive, and more flexible for the stylesheet writer.

I hope I have been clear in explaining my concern. Do you agree with my
conclusions? Is there anything I'm neglecting to take into consideration?

Thank you very much for taking the time to consider this issue. Again, if
you are not the person I should be sending this to, I'd appreciate it if you
could get me in touch with the right person. If there is anything else I can
do, or if you have any questions, please feel free to e-mail.

Sincerely,

Keith Devens

References:
[1] http://www.w3.org/TR/2001/WD-css3-box-20010726/#the-ltlengthgt
[2] http://www.w3.org/TR/REC-CSS2/visudet.html#the-height-property
[3] http://www.keithdevens.com/weblog/?id1950

← RSSRuby makes me feel good →

Comments XML gif


Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

December 2008
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
28293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 4 posts

Recent comments XML

Girls, please don't get breast implants

I have 34 A breast but at 22 years​old they seem to be growing again​which ...

76.64.120.153: Dec 3, 10:00am

Perl 6 1.0 in March?

Doh, my mistake. I'm aware of the​relation between Parrot and Rakudo​but I'...

Keith: Dec 2, 1:03am

Free image hosting sites

Well, TinyPic has this in its​FAQ:

> Images and videos is in​your accoun...

Keith: Dec 1, 1:13am

Join a NameValueCollection into a querystring in C#

Well with a lamba expression, this​is what I came up​with:

?!code:csharp...

Gustaf Lindqvist: Nov 30, 4:38pm

Generated in about 0.21s.

(Used 8 db queries)

mobile phone