Dar*_*io 20 html css google-chrome
我正在尝试将背景图像设置为表格行,但背景应用于其所有td子项.
在IE7中有相同的错误,但它解决了
tr {
position: relative;
}
Run Code Online (Sandbox Code Playgroud)
关于它的任何暗示?
谢谢
s_h*_*itt 12
这适用于所有浏览器:
tr {
background: transparent url(/shadow-down.gif) no-repeat 0% 100%;
display: block;
position: relative;
width: 828px;
}
tr td{
background: transparent;
}
Run Code Online (Sandbox Code Playgroud)
这是我所知道的唯一不使用 JavaScript 的解决方案。它的缺点是需要指定 TR 和 TD 的高度,因为 TR 是绝对定位的。我也不确定它在其他浏览器中的表现如何。
<style>
tr {
position: absolute;
background: url(http://www.google.com/intl/en_ALL/images/logo.gif) no-repeat;
height: 200px;
border: 1px solid #00f;
}
td {
width: 200px;
height: 200px;
border: 1px solid #f00;
}
</style>
<table cellpadding="0" cellspacing="0">
<tr>
<td></td>
<td></td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17572 次 |
| 最近记录: |