我有以下 HTML 代码:
<table width="600px" height="275px" cellspacing="10" cellpadding="0" border="0" align="center" style="background: #ffff00; padding-left:0px; padding-right:0px; text-align: center;">
<tbody>
<tr>
<td colspan="3">Silo'd Doc & Header - "Your doctors wants to connect with you."</td>
</tr>
<tr style="text-align: center;">
<td style="height: 275px; width: 175px; background: url('http://wmed.com/images/email/POLCampaign/BlueBox.png') no-repeat;">STUFF GOES HERE</td>
<td style="height: 275px; width: 175px; background: url('http://wmed.com/images/email/POLCampaign/BlueBox.png') no-repeat;">OTHER STUFF GOEScd HERE</td>
<td style="height: 275px; width: 175px; background: url('http://wmed.com/images/email/POLCampaign/BlueBox.png') no-repeat;">AND FINALLY</td>
</tr>
</tbody>
</table>
在 IE 中显示以下内容:
以及 FF 中的以下内容:
我会使用 SPAN
/DIV
但我的代码库中只允许使用 table
。
我怎样才能让蓝色框在黄色主表内水平居中,并且每个蓝色框的内容都保留在蓝色框内,所有浏览器的边缘都有 5 像素的填充?
最佳答案
添加overflow:auto
和 word-wrap:break-word
给你的<td>
元素。
CMIIW~
关于html - 如何将内容保留在表格的单元格内并留有一定的边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22509318/