Previous Message
Next Message

center a floated div!?!] - resolved

Sent by Wes Carr on 3 August 2004 15:03


Bruno Fassino wrote:

> <>If I understand well you want to "shrink wrap" (to add borders or 
> something
> like that) an image without knowledge of its width in the css, you 
> also have
> small captions, and then you want center the whole thing.
> Instead of using a float, you could use a container with
> display:table/table-cell. This gives you the shrink-wrap effect and can be
> horizontally centered with auto margins.
> But it doesn't work in IE (nor Window, neither Mac.) For these you could
> try display:inline-block, which should give the shrink wrap effect, 
> and can
> be centered inside a container with text-align:center.
> I've an example here <http://www.brunildo.org/test/shrink_img3.html>
> Please note that this is just an experiment...
>
> Bruno

Uhmm, wow! I never really knew what table/table-cell displays were for, 
and excellent hack for IE. You've saved me much grief. The display:table 
approach works in Opera and Safari btw.

Cheers,
Wes
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: