How to align 3 divs (left/center/right) inside another div?

Posted by serg555 on Stack Overflow See other posts from Stack Overflow or by serg555
Published on 2010-04-08T21:49:54Z Indexed on 2010/04/08 21:53 UTC
Read the original article Hit count: 314

Filed under:
|
|

I want to have 3 divs aligned inside a container div, something like this:

[[LEFT]       [CENTER]        [RIGHT]]

Container div is 100% wide (no set width), and center div should remain in center after resizing the container.

So I set:

#container{width:100%;}
#left{float:left;width:100px;}
#right{float:right;width:100px;}
#center{margin:0 auto;width:100px;}

But it becomes:

[[LEFT]       [CENTER]              ]
                              [RIGHT]

Any tips?

© Stack Overflow or respective owner

Related posts about css

Related posts about css-positioning