我有一个HTML表格
<table width="600" cellspacing="0" cellpadding="0">
<tr>
<td><img src="image.jpg" width="600" height="170" style="padding:0; margin:0;"></td>
</tr>
<tr>
<td>
<p style="padding:0; margin:0;">Text</p>
</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
尽管指定了填充,边距为0.我可以在Outlook 2003,2002电子邮件客户端中看到图像和文本之间的一些空白区域.
我怎么摆脱它?
你最有可能看到线的高度<td>.使用以下CSS删除它以及任何空格:
/* Gets rid of table cell whitespace */
table td {
line-height: 0;
font-size: 0;
}
/* Sets the font and line height correctly for the paragraph of text */
table td p {
line-height: 14px;
font-size: 14px;
}
Run Code Online (Sandbox Code Playgroud)
你可以在这里看到它.
| 归档时间: |
|
| 查看次数: |
8874 次 |
| 最近记录: |