如何在不弄乱表格结构的情况下自动调整表格高度?

时间:2014-02-14 15:59:53

标签: html css html-table resize

我使用切片功能将网站从Photoshop导出到Dreamweaver。它作为表导出。我留下了一段内容应该去的地方。我希望带有内容的单元格根据我放入的文本大小自动调整宽度。这就是单元代码的样子:

    <td colspan="5" valign="top" style="Background-image:url('images/Content_Background.gif'); background-repeat:repeat-y;">

        <p>&nbsp;</p>
        <p class="MsoNormal" align="center" style="text-align:center;"><span style="line-height:107%; font-size:28.0pt; color:white; ">Welcome!</span></p>
      <p class="MsoNormal"><span style="line-height:107%; font-size:20.0pt; color:white; ">&nbsp;</span></p>
        <p class="MsoNormal"><span style="font-size:20.0pt; color:white; ">        Think of a website that you love to be  on. Maybe its Facebook, Twitter, Instagram, Amazon, or even Google. Ever wish  you could make your own website, perhaps featuring your school work, or even  just to show off to your friends? Here, you can learn how. You will learn a  variety of ways to create a site, from canned templates, to Photoshop and  Dreamweaver, and even starting from complete scratch. Just click Build-A-Site  at the top to get started!</span></p></td>

这是输出:

http://postimg.org/image/6tvf7pdup/

我可以解决问题的唯一方法是,如果我将单元格设置为图像的原始高度,这会失败:

http://postimg.org/image/kfql2fn7r/

我不是那里的额外空间。此外,background-repeat标记工作正常,因为添加更多文本会使单元格更长,没有任何变形。它使它变得更小,杀死了桌子。任何解决方案?

1 个答案:

答案 0 :(得分:1)

给表固定宽度&amp; CELLPADDING。另外,当您为每个 p span 提供内联css时,为什么不在该长段上添加 line-height 属性。

抱歉,我没有看到您正在谈论的背景图片。