Previous Message
Next Message

center a floated div!?!]

Sent by Bruno Fassino on 3 August 2004 12:12

Wes Carr wrote:

> ... In my case there is other content that I do
> not wanted center aligned but do want confined to the left and right
> edge of the image. Please take a look at the original test page, and
> you'll see that using a center alignment won't cut it. The purpose of my
> design to center a floated div, not just to center an image.

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  <>
Please note that this is just an experiment...


css-discuss [EMAIL-REMOVED]]
List wiki/FAQ --
Supported by --
Previous Message
Next Message

Message thread: