【发布时间】:2012-02-27 04:59:19
【问题描述】:
我正在尝试将背景图像跨越 2 个表格行,但这似乎不起作用。
HTML:
<table id="branchTable">
<thead>
<th align="center">Tel.</th>
<th align="center">Fax</th>
<td rowspan="2" id="branch-logo"> d</td>
</thead>
<tbody>
<td align="center">${_branch?.tel}</td>
<td align="center">${_branch?.fax}</td>
</tbody>
</table>
css:
#branch-logo {
background-image: url(/public/images/logo.png);
height:53px;
width:100px;
background-repeat: no-repeat;
background-position: left;
}
图像似乎将行向下推,而不是跨越。
更新
<table id="branchTable">
<tr id="thead">
<th align="center">Tel.</th>
<th align="center">Fax</th>
<td rowspan="2" id="branch-logo"> d</td>
</tr>
<tr id="tbody">
<td align="center">${_branch?.tel}</td>
<td align="center">${_branch?.fax}</td>
</tr>
</table>
rowspan 似乎在 tbody 和 thead 之间不起作用。使用 tr 就可以了。
【问题讨论】:
-
我在您发布的 html 中的任何地方都看不到
#branch-logo。你的桌子有 1 行。事实上,由于 HTML 格式错误,它实际上没有任何行。 -
好指针,愚蠢的错误......
标签: html html-table