【问题标题】:How to change default highlighted color of dropdown in handsontable to another color如何将handsontable中下拉菜单的默认突出显示颜色更改为另一种颜色
【发布时间】:2016-05-30 09:17:57
【问题描述】:

我有一个Handsontable,如下:

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

我的表格中也有下拉菜单。当我查看下拉菜单时,默认情况下使用浅灰色突出显示。请查看下图:

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

【问题讨论】:

    标签: jquery css drop-down-menu background-color handsontable


    【解决方案1】:

    覆盖这个类:

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

    【讨论】:

      【解决方案2】:

      只需添加这个 CSS:

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

      我还可以解释我是如何到达那里的,所以你可以学习“如何钓鱼”:

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

      Video on how to do it。在我使用这些步骤完成之后,我还将向您展示如何手动更改某物的状态以模拟它“悬停”,以便轻松理解 CSS 在那里发生的事情。

      【讨论】:

        【解决方案3】:

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

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

        希望对您有所帮助! ;)

        【讨论】:

        • 谢谢哥们的帮助。
        【解决方案4】:
        <style>
        .handsontable.listbox tr td.current {
        background-color : green;
        }
        </style>
        

        【讨论】:

          【解决方案5】:

          添加你的 CSS

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

          【讨论】:

            【解决方案6】:

            Working Edited code here

            css更新了,请检查

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

            }

            【讨论】:

            • AAh 在我发帖的时候已经有很多答案了.. 好的,但也要保留这个答案。:)
            猜你喜欢
            • 2013-10-17
            • 2019-09-05
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2011-08-17
            • 2018-07-10
            • 2013-07-17
            • 2018-06-21
            相关资源
            最近更新 更多