Re: box-sizing alternative

On Tue, 29 Feb 2000 10:09:43 -0500, "Joe Hewitt" (joe@joehewitt.com)
wrote:
> I am of the believe that the defined behavior of sizing in CSS/CSS2 is very
> misleading and will result in a good deal of confused developers and broken
> layouts.  It seems to me that the property "width" (and height also) should
> refer to the width of the ENTIRE element, including content, border and
> padding, but not margin.  As it is defined by the W3C, "width" actually
> means "content-width".  I believe it would be a good idea to then add an
> element called "content-width" to CSS3, and change the meaning of "width".

There are a number of problems with this proposal:

 * It does not work well with the cascade:  if an author wants the
   contents of an element to take up a certain area, and the user has a
   different padding or border specified (think, perhaps, of images in
   links), then the content will occupy a different size than the author
   expects.

 * It makes it impossible to specify a size for the content of an element,
   whereas in the current system it is possible both to specify the
   size for the content box, or, with extra markup, the size for the
   margin box (however, see below).

 * It is not backwards compatibile with those browsers that have paid
   attention to the spec.

I think the problems you mention could be solved instead by:

 * A new value for the 'overflow' property called 'grow', that acts
   like the original proposal for 'visible' did.

 * A 'box-sizing' or 'border-width' property, or a proposal for
   :inside/:outside pseudo-elements.  (Ian Hickson made a proposal for
   the latter and retracted it, and I think it would be a good idea to
   resurrect it, for a number of reasons.  I have a half-written post
   on the topic that I'll eventually finish.  There are some sticky
   issues, but it would be very useful if they can be resolved.)

-David

L. David Baron    Sophomore, Harvard (Physics)    dbaron@fas.harvard.edu
Links, SatPix, CSS, etc.     <URL: http://www.fas.harvard.edu/~dbaron/ >
WSP CSS AC                      <URL: http://www.webstandards.org/css/ >

Received on Tuesday, 29 February 2000 12:05:53 UTC