Forum Moderators: open
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr valign="middle">
<td width="20%"><form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHiAY (...) PKCS7-----">
</form></td>
<td>Sample Text</td>
</tr>
</table>
[edited by: encyclo at 1:24 am (utc) on Feb. 4, 2007]
[edit reason] fixed side-scroll [/edit]
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="middle" width="20%"><form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form></td>
<td valign="middle">Sample Text</td>
</tr>
</table>
You can do a couple of things...
1. Make the form display inline so that it can be vertically aligned. (<form style="display:inline;" action=.....)
2. Put the form outside the table and just include the image submit button in the cell. (<form><table>.....</table></form>)
Also - you can use CSS to do all of this:
Put in <head> and remove valign attribute. You probably want to use specific classes for tables that you want to work this way - for instance <table class="valign"> ->
For all tables and forms:
<style>
table tr td {
vertical-align:middle;
}
form {
display:inline;
}
</style>
For tables with the "valign" class (and forms in those tables):
<style>
table.valign tr td {
vertical-align:middle;
}
table.valign form {
display:inline;
}
</style>