samanta

samanta

  • NA
  • 429
  • 135.7k

Align Div vertically middle

Apr 7 2014 3:24 AM

i want to align div vertically align middle.

i tried the following code but i getting some problem so please help me.


problem is when i add one more div after a main div, the subdiv position will get change.....

this is my code:

<body>


<div id="mainDiv" style="height:200px;width:600px; display:table;border:1px solid black">


<div " subDiv" style="padding-left:20px;padding-right:35px; height:20px; display:table-cell; vertical-align:middle" >
<div style=" float:left; width:200;"><span style="color:#C36">Do you like this?</span></div>
<div style=" float:right;width:30px;"><input type="submit" value="Yes"></div>
</div>


</div>
</body>




Answers (1)