首页 > 解决方案 > 需要在选择表格行时创建背景颜色

问题描述

去做 :

当前表格 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;
}

当我尝试上面的代码时,背景颜色正在影响整个表格。但我只需要在选择表行上。

标签: cssuitableviewcss-color

解决方案


根据您的问题,这是您想要实现的目标吗?

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>

希望我有所帮助。


推荐阅读