html - 如何将内容保留在表格的单元格内并留有一定的边距

标签 html css html-table

我有以下 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 &amp; Header - &quot;Your doctors wants to connect with you.&quot;</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:autoword-wrap:break-word给你的<td>元素。

CMIIW~

关于html - 如何将内容保留在表格的单元格内并留有一定的边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22509318/

相关文章:

javascript - 我如何使用 jquery 或 DOM 从 HTML 表格中获取单元格?

html - 无法在各自的文件夹中访问网站 css 和 javascript

jquery 工具验证器无法正常工作并出现元素卡在父元素下方的问题

javascript - 使用 Javascript 将表拆分为一行的单独表

html - 如何在另一个具有最小高度的 div 中将两个 div 元素一起缩放?

css - 带有额外全宽列的 HTML 表格行

html - CSS - 限制单元格宽度不超过剩余空间

jquery - 显示 jQuery 中的隐藏元素

php - 如何从函数内部回显有关每个项目的数据?

html - 如何在动画中途水平翻转图像