css - 需要在选择表格行时创建背景颜色
问题描述
去做 :
- 在使用 css 或任何其他方式选择表格行时创建背景颜色作为突出显示
当前表格 HTML:
<table id="ember11999" class="ember-view content-table focus-group ovalview object-table container-view highlighted">
<tbody id="ember12032" class="ember-view body-view container-view">
<tr id="ember12347" class="ember-view content-row body-row-view container-view" tabindex="0" aria-label="">
<td>...</td>
<td>...</td>
</tr>
</tbody>
</table>
试过CSS:
table.content-table.ovalview.highlighted tr.content-row {
background: #FFFF99 none 0 0 repeat;
}
当我尝试上面的代码时,背景颜色正在影响整个表格。但我只需要在选择表行上。
解决方案
根据您的问题,这是您想要实现的目标吗?
table.content-table.ovalview.highlighted tr.content-row.inspected:focus {
background: #FFFF99 none 0 0 repeat;
}
<table id="ember11999" class="ember-view content-table focus-group ovalview object-table container-view highlighted">
<tbody id="ember12032" class="ember-view body-view container-view">
<tr id="ember12347" class="ember-view content-row body-row-view container-view inspected" tabindex="0" aria-label="">
<td>Click</td>
<td>me</td>
</tr>
<tr id="ember12347" class="ember-view content-row body-row-view container-view inspected" tabindex="0" aria-label="">
<td>Click</td>
<td>me</td>
</tr>
</tbody>
</table>
希望我有所帮助。
推荐阅读
- python - xlwings:使用 .expand() 垂直而不是水平对数据进行分组?
- php - 如何通过 select 和 foreach 过滤日期?
- php - 用PHP将多维数组转换为html表
- yosys - Yosys:获取盖茨/晶体管数量
- sql - 从 csv 文件加载到 postgres 数据库时,如何解决此错误“从字符串“\N”到类型“双”的转换无效”?
- gatling - 在 PUT 请求中发送 JSON
- openstack - 如何使用自助服务网络配置 openstack 多合一
- javascript - 如何在 Electron/ionic App 上使用离子键盘
- python - 如何在dict中搜索未知的元组
- jenkins - 用于在矩阵上重新运行失败构建的脚本