On Sep 17, 2011, at 1:00 AM, Tim Arnold wrote:

>>> Hi is there a way to expand the width of a parent container so that it fits
>>> the contents of the floated elements within it?
> On Fri, Sep 16, 2011 at 11:50 AM, Kevin A. Cameron
> <kevinacame...@gmail.com> wrote:
>> Pretty sure if you float the parent, it will grow to fit the content.
>> 
>> Kevin
>> 
>> 
> 
> If, for some reason, you can't float the parent, there are other ways
> to accomplish it as well.  Try adding "overflow: hidden;" to the
> parent (may bring it's own problems), or read about the "clearfix"
> method here: http://www.positioniseverything.net/easyclearing.html

Tim, those 'clearfix' methods, aka 'containing' floats are methods to expand 
the /height/ of  the parent element that only contains floated blocks. What the 
OP wants is expanding (and contracting ?) the /width/ of said parent element.

Kevin is right on the money that floating the parent element will most probably 
accomplish this – providing no width of max-width is specified (min-width is 
fine though). An alternative is using display:table-cell (or table), at the 
cost of less compatibility (IE 7 and older).

Philippe
--
Philippe Wittenbergh
http://l-c-n.com/






______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to