HTML+CSS:自动换行后 TD 之间不需要的 space
HTML+CSS: Unwanted space between TDs after word-wrapping
<table cellpadding="0" cellspacing="0" style="mso-table-lspace:0pt; mso-table-rspace:0pt;border-spacing: 0;border-collapse: collapse;margin: 0 auto;">
<tr>
<td valign="top" height="13" style="color: #ff8000;font-weight: normal;vertical-align:top;mso-line-height-rule:exactly;line-height: 18px;">
›
</td>
<td valign="top" height="13" style="font-weight: normal;vertical-align:top;mso-line-height-rule:exactly;line-height: 18px;">
<a style="padding-left: 10px;color:#4D4D4D;font-family: Arial, Helvetica, sans-serif;font-weight: bold;font-size: 13px;text-decoration: none;" th:href="${n.desktopUrl}" th:utext="${n.headline}">
Long long long text which will be wrapped
</a>
</td>
<td valign="top" height="13" style="display: inline;padding-left: 10px;">Button code</td>
</tr>
我得到的结果是:
enter image description here
如何在自动换行后避免这种情况space?
<td>
元素上有一个 padding-left: 10px
- 这就是造成大间隙的原因
<td valign="top" height="13" style="display: inline;padding-left: 0px;">Button code</td>
将padding-left
的值设置为0。
<table cellpadding="0" cellspacing="0" style="mso-table-lspace:0pt; mso-table-rspace:0pt;border-spacing: 0;border-collapse: collapse;margin: 0 auto;">
<tr>
<td valign="top" height="13" style="color: #ff8000;font-weight: normal;vertical-align:top;mso-line-height-rule:exactly;line-height: 18px;">
›
</td>
<td valign="top" height="13" style="font-weight: normal;vertical-align:top;mso-line-height-rule:exactly;line-height: 18px;">
<a style="padding-left: 10px;color:#4D4D4D;font-family: Arial, Helvetica, sans-serif;font-weight: bold;font-size: 13px;text-decoration: none;" th:href="${n.desktopUrl}" th:utext="${n.headline}">
Long long long text which will be wrapped
</a>
</td>
<td valign="top" height="13" style="display: inline;padding-left: 10px;">Button code</td>
</tr>
我得到的结果是: enter image description here
如何在自动换行后避免这种情况space?
<td>
元素上有一个 padding-left: 10px
- 这就是造成大间隙的原因
<td valign="top" height="13" style="display: inline;padding-left: 0px;">Button code</td>
将padding-left
的值设置为0。