我正在为电子邮件编码菜单栏 - 因此是凌乱的表格。我需要两个菜单选项" Point"和"我的个人资料"在表格的右侧对齐:
<table class="organicweb1" style="border-collapse:collapse" cellspacing="0" cellpadding="0" border="0" align="center" width="100%;">
<tbody>
<tr>
<td style="padding:10px 0px 10px 0px" align="center" valign="top">
<table style="border-collapse:collapse; border: 1px solid red;" cellspacing="0" cellpadding="0" border="0" align="center" width="600">
<tbody>
<tr>
<td align="left" width="35" valign="top"> </td>
<td align="center" width="590" valign="middle">
<table style="border-collapse:collapse" cellspacing="0" cellpadding="0" border="0" align="center" width="590">
<tbody>
<tr>
<td style="padding:7px 0px 7px 0px" align="center" valign="middle">
<table style="border-collapse:collapse" cellspacing="0" cellpadding="0" border="0" align="left">
<tbody>
<tr>
<td style="font-family:Tahoma,Geneva,sans-serif;font-size:14px;line-height:120%;color:#512DA8" align="center" valign="top">
<a href="http://example.com" style="color:#004b60;text-decoration:none" target="_blank">Book</a>
<span> </span>
<a href="http://example.com" style="color:#004b60;text-decoration:none" target="_blank">Gift</a>
<span> </span>
<a href="http://example.com" style="color:#004b60;text-decoration:none" target="_blank">Voucher</a>
<span> </span>
<a href="http://example.com" style="color:#004b60;text-decoration:none" target="_blank"></a>
<span> </span>
<a href="http://example.com" style="color:#004b60;text-decoration:none; background-color: red; padding: 5px 10px 5px 10px; text-align: right;" target="_blank"><b>Point:</b></a>
<span> </span>
<a href="http://example.com" style="color:#004b60;text-decoration:none; background-color: red; padding: 5px 10px 5px 10px; text-align: right;" target="_blank"><b>My profile</b></a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
<td align="left" width="35" valign="top"> </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
&#13;
我尝试在text-align:right;
代码a
代码上设置td
,但我无法让两个选项正确对齐。
如果我在桌面上设置text-align,我可以将它们对齐。但随后所有文本都正确对齐。
有人知道我在这里做错了吗?
答案 0 :(得分:1)
我认为这对您有用 -
我已将内部表width
添加到100%
并将<a>
标记拆分为两个<td>
并将float
分配给他们。
<table class="organicweb1" style="border-collapse:collapse" cellspacing="0" cellpadding="0" border="0" align="center" width="100%;">
<tbody>
<tr>
<td style="padding:10px 0px 10px 0px" align="center" valign="top">
<table style="border-collapse:collapse; border: 1px solid red;" cellspacing="0" cellpadding="0" border="0" align="center" width="600">
<tbody>
<tr>
<td align="left" width="35" valign="top"> </td>
<td align="center" width="590" valign="middle">
<table style="border-collapse:collapse" cellspacing="0" cellpadding="0" border="0" align="center" width="590">
<tbody>
<tr>
<td style="padding:7px 0px 7px 0px" align="center" valign="middle">
<table style="border-collapse:collapse;width:100%" cellspacing="0" cellpadding="0" border="0" align="left" width: "100%">
<tr>
<td style="font-family:Tahoma,Geneva,sans-serif;font-size:14px;line-height:120%;color:#512DA8;float:left" align="center" valign="top">
<a href="http://example.com" style="color:#004b60;text-decoration:none" target="_blank">Book</a>
<span> </span>
<a href="http://example.com" style="color:#004b60;text-decoration:none" target="_blank">Gift</a>
<span> </span>
<a href="http://example.com" style="color:#004b60;text-decoration:none" target="_blank">Voucher</a>
<span> </span>
<a href="http://example.com" style="color:#004b60;text-decoration:none" target="_blank"></a>
<span> </span>
</td>
<td style="float:right">
<a href="http://example.com" style="color:#004b60;text-decoration:none; background-color: red; padding: 5px 10px 5px 10px; text-align: right;" target="_blank"><b>Point:</b></a>
<span> </span>
<a href="http://example.com" style="color:#004b60;text-decoration:none; background-color: red; padding: 5px 10px 5px 10px; text-align: right;" target="_blank"><b>My profile</b></a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
<td align="left" width="35" valign="top"> </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
希望这对你有所帮助。
答案 1 :(得分:0)
试试这个代码段:
<a href="http://example.com"
style=
"color:#004b60;
text-decoration:none;
background-color: red;
padding: 5px 10px 5px 10px;
margin-left:250px;"
target="_blank"><b>Point:</b>
</a>
使用margin-left:250px;而不是text-align:right;