代码之家  ›  专栏  ›  技术社区  ›  Herman Cordes

如何在自动调整大小的表格上填写表格数据内容?

  •  0
  • Herman Cordes  · 技术社区  · 16 年前

    我把这个例子简化为:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head><title>Test</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /></head>
    <body>
    
    <table cellspacing="0" cellpadding="0" style="width: 500px; border: 2px solid blue;">
        <tr>
            <td style="height: 100%;"><div style="height: 100%; background-color: yellow;">left<br />left<br />left<br />left<br />left</div></td>
            <td style="height: 100%;"><div style="margin-left: 20px; height: 100%; background-color: yellow;">right</div></td>
        </tr>
    </table>
    
    </body>
    </html>
    

    因此,我希望黄色块具有相同的高度,而不给table/row/cell/div一个固定的宽度(relative很好)。我知道表格单元格可以有黄色的背景,但这是一个简化的块的例子,可以最小化,移动等,所以给表格单元格一个颜色不是一个选择。使用表格是没有必要的,但我认为最好能说明这个例子。

    感谢回复!

    1 回复  |  直到 16 年前
        1
  •  0
  •   easwee    16 年前

    作为一个解决方案,你可以尝试用人造柱。单子上有一篇很好的文章 http://www.alistapart.com/articles/fauxcolumns/ .