center div tags inside parent div

Posted by Senthilnathan on Stack Overflow See other posts from Stack Overflow or by Senthilnathan
Published on 2012-09-05T09:33:48Z Indexed on 2012/09/05 9:38 UTC
Read the original article Hit count: 215

Filed under:
|
|

I have two div tags inside a parent div. I want to display the two divs in same line and centered. Below is the html code.

<div id="parent">
    <div id="addEditBtn" style="display:inline-block; vertical-align: middle; width:20px; cursor:pointer;" class="ui-state-default ui-corner-all"> <span class="ui-icon ui-icon-pencil"></span></div>

    <div id="deleteBtn" style="display:inline-block; vertical-align: middle; width:20px; cursor:pointer;" class="ui-state-default ui-corner-all"> <span class="ui-icon ui-icon-trash"></span></div>
</div>

I tried with "display:inline-block; vertical-align: middle;" but its getting aligned left. Please help me out to centered the div tags inside the parent div.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html