Previous Message
Next Message

Centering multiple floated blocks

Sent by Alex Robinson on 11 January 2008 22:10

A combination of display:table (Mozilla, Opera) and 
display:inline-block (IE) can cause a wrapper around floats to 
shrink-to-fit and thus be made amenable to being centered.

However, Safari (neither 2 nor 3) does not do the shrink wrapping and 
so no centering occurs. As far as I know - I'd love to be told that 
I'm wrong.

Paul O'Brien has an alternative approach that can be summed up as:

Outer wrapper:
float: left; position: relative and left: 50%

Inner wrapper
position: relative; left: -50%

It is not without drawbacks, but it may be good enough for your needs
css-discuss [EMAIL-REMOVED]]
List wiki/FAQ --
List policies --
Supported by --
Previous Message
Next Message

Message thread:

Possibly related: