0

我正在处理时事通讯 HTML,我无法让 div 居中对齐。如何将按钮对齐到 div 的中心。这是简单的代码

<table border="0" cellpadding="0" cellspacing="0" width="600">  
<tr>
<td>  

<div style="text-align:center;">
<a href="#" style="display:block; width:150px; text-decoration:none; font-weight:bold; color:#fff; background:#c72622; font-size:20px; border-radius:7px; -webkit-border-radius:7px; padding-top:10px; padding-bottom:10px;">
Buy Now
</a>
</div>

</td>
</tr>
</table>
4

2 回答 2

0

避开所有填充和边距,许多客户对它们的支持很差/错误。而是使用大量嵌套表<tr> <td height="1234" align="center/left/right">。尽可能避免使用该<table align="center/left/right">属性,因为 Outlook 会生成额外的空格。我<table align="center">用于我的包装表。

对于垂直对齐,请使用s 和s 的valign属性。如果该行中的另一个图像具有您想要垂直对齐的高度,则效果最佳。<td><tr>td

于 2013-09-03T16:56:36.417 回答
0

添加align="center"到包含表格的单元格中。这是在 HTML 电子邮件中居中对齐的最佳方式。

于 2013-09-02T02:19:03.780 回答