Is it possible to center a div inside a div horizontally? - Programmers Heaven

Howdy, Stranger!

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

Categories

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

danielm77danielm77 USAPosts: 72Member

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

Tagged:

Comments

  • DavidMDavidM USAPosts: 342Member
    edited January 2014

    Assume your div setup as follows.

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

    Add CSS as follows.

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