html - 覆盖表格特定行的悬停样式
问题描述
我们有一个这样定义的通用 CSS 样式:
.table-container table tr:hover td {
background-color: #eaeaea;
}
这用于跨应用程序的所有表。但是,我必须为特定行上的特定表覆盖它。我<tr class=‘edited’>
用这个定义在每个地方附加了新的 css 样式:
.edited {
background-color: #f8cbad;
}
但是,当悬停在行上时,它使用通用悬停样式,我无法覆盖它。
您能否建议如何覆盖它,以便即使在悬停行时我也能看到与编辑样式相同的背景颜色?
我尝试了跟随和调整,但没有奏效。
.table-container table tr:hover .edited td {
background-color: #eaeaea;
}
解决方案
好的,经过一番尝试,我已经弄清楚了。回答以帮助他人:为特定样式类定义悬停可以解决问题:
.edited {
background-color: #f8cbad;
}
.edited:hover {
background-color: #f8cbad !important;
}
推荐阅读
- aframe - 如何在框架和 cannon.js 中创建弹簧
- javascript - Webpack Encore - 模块规则 - 将 scss 变量导出/导入到 javascript 时出错
- javascript - 将表格单元格链接到复选框 Javascript
- python - Python模板forloop不工作不止一次
- mysql - 将列数据转换为列名
- python - YAML/JSON 必需属性不适用于对象属性
- angular - Angular + webpack + require.context:避免在主包中包含模拟数据
- web-scraping - Python 请求 - 无法获得 POST 表单响应(仅返回表单)
- node.js - 无法使用适用于 Node.js 的 Admin SDK 在 Firebase 存储中将 Content-Disposition 覆盖为“内联”
- php - 未使用 mysqli_real_escape_string() 在表单提交方法中获取数组值