Cal*_*ins 3 html css background-color
我有一个包含多行和两列的表.我希望整个表格行在使用时更改背景颜色#highlight:target.我已经能够使单个细胞改变颜色<td id="highlight">但不改变颜色<tr id="highlight">
CSS:
#highlight:target {
background-color: #FF9900;
-webkit-transition: all 1s linear;
}
Run Code Online (Sandbox Code Playgroud)
HTML:
<a href="#highlight">Highlight!!</a>
<table>
<tr id="highlight">
<td>First Column</td>
<td>Second Column</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
我可以使用:target选择器更改整行的背景颜色吗?
你需要定位细胞.
#highlight:target td {
background-color: #FF9900;
-webkit-transition: all 1s linear;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2373 次 |
| 最近记录: |