W3C home > Mailing lists > Public > www-style@w3.org > October 1999

Re: Unlogical width with percentages

From: Ian Hickson <py8ieh@bath.ac.uk>
Date: Sun, 10 Oct 1999 21:44:04 +0100 (BST)
To: Tantek Celik <tantek@cs.stanford.edu>
cc: Sjoerd Visscher <sjoerd@heeten.nl>, www-style <www-style@w3.org>
Message-ID: <Pine.GSO.4.04.9910102131380.6224-100000@ss1.bath.ac.uk>
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;">
      </div>
   </div>

...has the same effect as:

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

...so 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 GMT

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