选项卡时更改整行的背景颜色?

问题描述 投票:-1回答:1

我有一个简单的表,有两列五行。我希望它更易于键盘访问。

左列只是文本,右列是聚焦/悬停时填充的按钮。

有没有办法在选项卡(聚焦)时更改整行的背景颜色并同时填充按钮背景颜色?

html-table focus background-color
1个回答
0
投票

编辑:为focus添加

假设你有一个这样的表:

<table style="width:100%">
  <tr class="hoverable-row">
    <th>Firstname</th>
    <th>Lastname</th> 
    <th>Age</th>
  </tr>
  <tr class="hoverable-row">>
    <td>Jill</td>
    <td>Smith</td> 
    <td>50</td>
  </tr>
  <tr class="hoverable-row">>
    <td>Eve</td>
    <td>Jackson</td> 
    <td>94</td>
  </tr>
</table>

然后在css

.hoverable-row:hover, :focus { 
    background-color: yellow;
}

另外,请阅读https://stackoverflow.com/help/how-to-ask如何以良好的方式提问。

© www.soinside.com 2019 - 2024. All rights reserved.