On Nov 1, 2006, at 3:14 AM, Mark Wheeler wrote:

> Is this even possible? (I'm sure it is, but I still feel pretty new
> to css) - Can you have a div (content) centered inside another div
> (container) BUT, the content div's width may be different because of
> content (thus you can't set the width) AND the div width must
> collapse around the content (so if a border was used, it would
> collapse around the content)? I can't figure this out. I'm sure there
> is a simple solution, but I can't seem to get there. Any help would
> be appreciative.

By default a div will take up all available width minus the margins.  
That is the nature of 'display:block' (default display:property of a  
div). To have your div shrinkwrap to the width of its content, you'd  
have to change the display property: use something like 'display:table'.
Or specify a width on it.
In both cases, the div would then be centred using 'margin:auto;'.

Philippe
---
Philippe Wittenbergh
<http://emps.l-c-n.com>




______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7 information -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to