html - 如何在表格中的 TD 列之间添加间距?
问题描述
我正在修复使用表格的电子邮件,并且正在尝试在td
标签中添加按钮。我面临的问题是,无论我尝试什么,我似乎都无法在每个按钮之间留出空格。这是它现在的样子:
这是生成它的 HTML(它是重复的):
<table>
<tr>
<td class="button">
<table border="0" cellpadding="0" cellspacing="0" align="center" style="max-width: 240px; min-width: 120px; border-collapse: collapse; border-spacing: 0; padding: 0;">
<tr>
<td align="center" valign="middle" style="padding: 12px 24px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -khtml-border-radius: 4px;" bgcolor="#E9703E">
<a target="_blank" href="https://google.com" style="text-decoration: underline; color: #FFFFFF; font-family: sans-serif; font-size: 17px; font-weight: 400; line-height: 120%;">Verify ORCiD</a>
</td>
<td align="center" valign="middle" style="padding: 12px 24px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -khtml-border-radius: 4px;" bgcolor="#E9703E">
<a target="_blank" href="https://facebook.com" style="text-decoration: underline; color: #FFFFFF; font-family: sans-serif; font-size: 17px; font-weight: 400; line-height: 120%;">Verify ORCiD</a>
</td>
<td align="center" valign="middle" style="padding: 12px 24px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -khtml-border-radius: 4px;" bgcolor="#E9703E">
<a target="_blank" href="https://twitter.com" style="text-decoration: underline; color: #FFFFFF; font-family: sans-serif; font-size: 17px; font-weight: 400; line-height: 120%;">Verify ORCiD</a>
</td>
<td align="center" valign="middle" style="padding: 12px 24px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -khtml-border-radius: 4px;" bgcolor="#E9703E">
<a target="_blank" href="https://twitter.com" style="text-decoration: underline; color: #FFFFFF; font-family: sans-serif; font-size: 17px; font-weight: 400; line-height: 120%;">Verify ORCiD</a>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="button">
<table border="0" cellpadding="0" cellspacing="0" align="center" style="max-width: 240px; min-width: 120px; border-collapse: collapse; border-spacing: 0; padding: 0;">
<tr>
<td align="center" valign="middle" style="padding: 12px 24px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -khtml-border-radius: 4px;" bgcolor="#E9703E">
<a target="_blank" href="https://google.com" style="text-decoration: underline; color: #FFFFFF; font-family: sans-serif; font-size: 17px; font-weight: 400; line-height: 120%;">Verify ORCiD</a>
</td>
<td align="center" valign="middle" style="padding: 12px 24px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -khtml-border-radius: 4px;" bgcolor="#E9703E">
<a target="_blank" href="https://facebook.com" style="text-decoration: underline; color: #FFFFFF; font-family: sans-serif; font-size: 17px; font-weight: 400; line-height: 120%;">Verify ORCiD</a>
</td>
<td align="center" valign="middle" style="padding: 12px 24px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -khtml-border-radius: 4px;" bgcolor="#E9703E">
<a target="_blank" href="https://twitter.com" style="text-decoration: underline; color: #FFFFFF; font-family: sans-serif; font-size: 17px; font-weight: 400; line-height: 120%;">Verify ORCiD</a>
</td>
<td align="center" valign="middle" style="padding: 12px 24px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -khtml-border-radius: 4px;" bgcolor="#E9703E">
<a target="_blank" href="https://twitter.com" style="text-decoration: underline; color: #FFFFFF; font-family: sans-serif; font-size: 17px; font-weight: 400; line-height: 120%;">Verify ORCiD</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
不知道如何解决这个问题,无论我尝试什么都不会添加空格。
编辑:得到它的工作,谢谢!
解决方案
您将border-collapse
属性设置为collapse
. 将其更改为separate
然后添加一些border-spacing
:
<table>
<tr>
<td class="button">
<table border="0" cellpadding="0" cellspacing="0" align="center" style="max-width: 240px; min-width: 120px; border-collapse: separate; border-spacing: 5px 0; padding: 0;">
<tr>
<td align="center" valign="middle" style="padding: 12px 24px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -khtml-border-radius: 4px;" bgcolor="#E9703E">
<a target="_blank" href="https://google.com" style="text-decoration: underline; color: #FFFFFF; font-family: sans-serif; font-size: 17px; font-weight: 400; line-height: 120%;">Verify ORCiD</a>
</td>
<td align="center" valign="middle" style="padding: 12px 24px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -khtml-border-radius: 4px;" bgcolor="#E9703E">
<a target="_blank" href="https://facebook.com" style="text-decoration: underline; color: #FFFFFF; font-family: sans-serif; font-size: 17px; font-weight: 400; line-height: 120%;">Verify ORCiD</a>
</td>
<td align="center" valign="middle" style="padding: 12px 24px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -khtml-border-radius: 4px;" bgcolor="#E9703E">
<a target="_blank" href="https://twitter.com" style="text-decoration: underline; color: #FFFFFF; font-family: sans-serif; font-size: 17px; font-weight: 400; line-height: 120%;">Verify ORCiD</a>
</td>
<td align="center" valign="middle" style="padding: 12px 24px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -khtml-border-radius: 4px;" bgcolor="#E9703E">
<a target="_blank" href="https://twitter.com" style="text-decoration: underline; color: #FFFFFF; font-family: sans-serif; font-size: 17px; font-weight: 400; line-height: 120%;">Verify ORCiD</a>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="button">
<table border="0" cellpadding="0" cellspacing="0" align="center" style="max-width: 240px; min-width: 120px; border-collapse: separate; border-spacing: 5px 0; padding: 0;">
<tr>
<td align="center" valign="middle" style="padding: 12px 24px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -khtml-border-radius: 4px;" bgcolor="#E9703E">
<a target="_blank" href="https://google.com" style="text-decoration: underline; color: #FFFFFF; font-family: sans-serif; font-size: 17px; font-weight: 400; line-height: 120%;">Verify ORCiD</a>
</td>
<td align="center" valign="middle" style="padding: 12px 24px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -khtml-border-radius: 4px;" bgcolor="#E9703E">
<a target="_blank" href="https://facebook.com" style="text-decoration: underline; color: #FFFFFF; font-family: sans-serif; font-size: 17px; font-weight: 400; line-height: 120%;">Verify ORCiD</a>
</td>
<td align="center" valign="middle" style="padding: 12px 24px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -khtml-border-radius: 4px;" bgcolor="#E9703E">
<a target="_blank" href="https://twitter.com" style="text-decoration: underline; color: #FFFFFF; font-family: sans-serif; font-size: 17px; font-weight: 400; line-height: 120%;">Verify ORCiD</a>
</td>
<td align="center" valign="middle" style="padding: 12px 24px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -khtml-border-radius: 4px;" bgcolor="#E9703E">
<a target="_blank" href="https://twitter.com" style="text-decoration: underline; color: #FFFFFF; font-family: sans-serif; font-size: 17px; font-weight: 400; line-height: 120%;">Verify ORCiD</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
推荐阅读
- javascript - 在 Javascript 中访问嵌套对象
- c - 数组的 C 指针问题
- node.js - Node.js + Oracledb + executeMany + batchErrors + Promise:如果出现错误则不执行所有
- javascript - 密码生成器问题
- java - Java / C套接字,发送多个变量并在客户端在不同的变量中接收
- nestjs - 当 Nestjs 应用程序加载时,最好的方法是什么?
- python - Xpath scrapy 结果与预期不符
- expo - Expo:独立应用程序中的 idToken = Null / Google Signin
- javascript - 路由到对象 ID 时在 express.js 中收到“无法获取”错误
- amazon-web-services - AWS Deep Lens 缺失库