Re: Percentage height meaurements.

Tantek Çelik wrote:
>> Tantek, do you implement min/max-width/height for replaced elements as
>> CSS2.1 describes it?  And also box-sizing as CSS3 UI describes it?
> 
> Yes as far as I remember (it has been a few years since I wrote the code).

Ah.  The CSS2.1 section in question is definitely considerably newer than a few
years old, I believe.

>> If so, doesn't that lead to undesirable distortion of replaced elements,
> 
> I don't know, do you have an example that attempts to demonstrate this?

Sure (well, not an example in HTML testcase form, but I could put such up if
desired).  Consider an image with an intrinsic size of 200px by 200px included
in an HTML page as:

   <img id="foo" src="whatever">

With the following style rule applied:

#foo {
   max-width: 100px;
   padding-right: 25px;
   padding-left: 25px;
   padding-top: 0;
   padding-bottom: 0;
   box-sizing: border-box;
}

Following the algorithm for replaced elements in the CSS2.1 CR, the computed
width and height are both 100px so that the aspect ratio is preserved, in the
absence of box-sizing.  However with box-sizing the computed width and height
are _still_ 100px (since the computed max-width is 100px, the computed
max-height is auto, and no changes have been made to the CSS2.1 algorithm).
Which means that the image is rendered 50px wide by 100px tall, changing the
aspect ratio.

I believe this can be addressed with appropriate modifications to the CSS2.1 
algorithm  (which would need to be presented in the context of CSS3 UI, since 
that's where box-sizing is defined).

I'm sorry I didn't present this example in the original mail; the problem was 
fresh on my mind because I'd been looking at the CSS2.1 algorithm in detail, and 
I didn't do a very good job of explaining it...

>> That's excellent news (though  the final determination will be made by the 
>> CSS2.1 test suite, once such a beast actually starts existing, of course).
> 
> Actually, the CSS3-UI test suite, once it starts existing, as you said.

Yes, indeed.  "CSS2.1" was a think-o.

> I believe that would result in you buying almost no second books by the vast 
> majority of authors of web books.

That's very true.  Already has, in fact.  ;)

-Boris

Received on Thursday, 27 May 2004 22:03:22 UTC