I am trying to make a simple input button center-align within a table cell.
My markup is:
<table width="500" border="1">
<tr>
<td width="390">XXXXXXXXX</td>
<td width="110" rowspan="2" valign="middle"><input type="button" value="submit"></td>
</tr>
<tr>
<td>YYYYYYYY</td>
</tr>
</table>
<br /><br />
<div style="width:500px;">
And may be viewed here:
I have done a table version showing you the layout that I am trying to achieve. Note that the text represented by "XXXXX" or "YYYYYY" is of variable length.
http://jsfiddle.net/8v8gLn4y/
update 2016:
flexbox http://jsfiddle.net/9knLeab6/1/
If you make your button an
inline
element and addtext-align: center
to the parenttd
you should be fine.See also: http://jsfiddle.net/c4urself/NucL9/