I have two divs, one inside another. The width of the outer div is given in percentage and the inside div is given an position:absolute
. I want to align the inner div in the center of outer div irrespective of the outer div's width percentage.
It works fine when position:absolute
is removed from the inner div, but I need that. Any help would be greatly appreciated.
I have the following code:
<div class='container' style='width:70%; position:relative'>
<div style='position:absolute; text-align:center' align='center'>
//contents
</div>
</div>