如何将 handsontable 中下拉菜单的默认突出显示颜色更改为另一种颜色

How to change default highlighted color of dropdown in handsontable to another color

我有一个Handsontable如下:

http://jsfiddle.net/nt001ymn/22/

我的 table 也有下降。当我查看 下拉菜单时,它默认使用浅灰色突出显示 。请检查下图:

如何将突出显示的颜色更改为另一种颜色。假设我想将突出显示的颜色更改为黄色。

覆盖这个class:

.handsontable.listbox tr td.current, 
.handsontable.listbox tr:hover td {
      background: #eee;
}

只需添加此 CSS:

.handsontable.listbox tr:hover td {
  background: #FF0; 
}

我也可以解释我是如何到达那里的,所以你学习 'how to fish':

  • 在 Chrome 上,打开页面并按 F12 打开开发者工具
  • 打开下拉菜单,将鼠标悬停在一个选项上,然后在 Mac 上按 CTRL+SHIFT+C 或 Cmd + Shift + C 以启动 'inspect mode'。
  • Select 您悬停的选项,您会看到它的 CSS / HTML。
  • 查看开发工具上的“样式”面板很容易理解 CSS 行是控制高亮颜色的行。
  • 在样式面板上将该颜色更改为黄色并查看结果。满意吗?完毕。把它放在你的 .css 文件中 :)

Video on how to do it。在我使用这些步骤完成之后,我还会向您展示如何手动更改某些东西的状态以模拟它是 'hovered',这样就很容易理解 CSS 在那里发生了什么。

默认灰色背景来自导入的手控表 CSS 文件。 要覆盖它,请在您自己的 CSS 文件中添加以下 CSS 样式:

.handsontable.listbox tr td.current, .handsontable.listbox tr:hover td {
    background: yellow !important;
}

希望对您有所帮助! ;)

<style>
.handsontable.listbox tr td.current {
background-color : green;
}
</style>

添加你的css

.handsontable.listbox tr td.current, .handsontable.listbox tr:hover td{
   background-color: yellow
}

Working Edited code here

css已更新,请查看

.handsontable.listbox tr td.current, .handsontable.listbox tr:hover td {
background: #ff0;

}