W3C home > Mailing lists > Public > www-style@w3.org > September 2009

[css3-box] a width that is a little less than 'fit-content'

From: Bert Bos <bert@w3.org>
Date: Tue, 15 Sep 2009 18:42:10 +0200
To: www-style@w3.org
Message-Id: <200909151842.11066.bert@w3.org>
Somebody asked me for a way to "shrink-wrap" a box around its content 
that is different from the three ways we are currently planning. I 
haven't thought about it yet, but I want to make sure it gets archived.

The three kinds of intrinsic size we have identified so far and which we 
plan to give their own keywords in CSS3 are:

min-content: the narrowest a box can get without unwanted overflow. If 
the box has just text, this will be the width of the longest word (or 
the longest syllable, if words are hyphenated).

max-content: the narrowest a box can get without causing unwanted line 
breaks. If the box has just text, this would be the width with all 
words on one line. Another way to think of this is that 'max-content' 
minimizes the height of a box, while 'min-content' minimizes the width.

fit-content: as much width as needed, up to the available space. This is 
equivalent to:

  max('min-content', min('max-content', width_of_containing_block))

The proposed fourth kind would be in between min-content and 
fit-content. An example probably explains it best. Consider a 
containing block of this width:

    <------------------------->

The four intrinsic sizes would give text that looks like this:

1) min-content:
    <------------------------->
    A
    paragraph
    of text
    that
    doesn't
    fit on
    one line.
    <!------>

2) max-content:
    <------------------------->
    A paragraph of text that doesn't fit on one line.
    <----------------------------------------------->

3) fit-content:
    <------------------------->
    A paragraph of text that
    doesn't fit on one line.
    <------------------------->

4) fit and then shrink more:
    <------------------------->
    A paragraph of text that
    doesn't fit on one line.
    <---------------------->

I don't know exactly what this is supposed to do in all cases, but the 
effect should be more or less as if the box was laid out as 
for 'fit-content' and then shrunk more without increasing the height.



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Tuesday, 15 September 2009 16:42:47 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:21 GMT