Re: Unlogical width with percentages

On Sun, 10 Oct 1999, Tantek Celik wrote:

>>> The current CSS3 drafts introduce a property which can be used to
>>> change what 'width' actually means, called 'box-sizing'. It
>>> currently takes the values 'content-box' and 'border-box'; I
>>> propose we add 'padding-box' and 'margin-box' for consistency.
> We could not come up with any "real world" examples where an author
> would want to use "padding-box" where "border-box" wouldn't work
> just as well.
> Similarly with "margin-box". "margin-box" would also introduce the
> additional complication of collapsable/overlapping heights - since
> adjacent vertical margins collapse. We did *not* want to go there.

Ok, fair points. 

Thankfully, using a transformation step (e.g. going through XSL), it
is possible to simulate 'margin-box' by wrapping the contents in a
block and then setting the width on that.

For example:

   <div style="float: right; width: 50%">
      <div style="margin: 2em; border: solid 2em; padding: 2em;">

...has the same effect as:

   <div style="width: 50%; float: right; box-sizing: margin-box; 
               margin: 2em; border: solid 2em; padding: 2em;">
   </div> limiting 'box-sizing' is not really a blocker.

Ian Hickson
"I take a Professor Bullett approach to my answers. There's a high
probability that they may be right."
  -- Dr Snow; Mechanics Lecturer at Bath University; 1999-03-04

Received on Sunday, 10 October 1999 16:44:08 UTC