ProAnswers.org

How to horizontally center DIV in DIV with CSS ?

Is anyone know how to horizontally center DIV in DIV with CSS
( if it’s possible at all ). Outer DIV has 100%:

Foo foo

I searched but not found this anywhere…

You can apply this CSS to the inner div:

#inner { 
    width: 50%; 
    margin: auto; 
} 



Of course, you don't have to set the width to 50%. Any width less than the containing div will work. The margin: auto is what does the actual centering.