Is it possible to center a div inside a div horizontally?

I need to center a div horizontally which is inside another div. Please show me how to do it.


  • DavidMDavidM USA
    edited January 2014

    Assume your div setup as follows.

    <div id="outerDiv" style="width:100%">  
        <div id="innerDiv">Some Content</div>

    Add CSS as follows.

    #inner {
    display: table;
    margin: 0 auto;
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion