【问题标题】:How can I add background color to datatable search box and select box如何将背景颜色添加到数据表搜索框和选择框
【发布时间】:2016-01-06 10:38:03
【问题描述】:

我正在使用 jquery-datatable 并希望为选择框和搜索框添加背景颜色。所以它看起来像具有相同背景颜色的标题。

$(document).ready(function(){
  $('#users').DataTable();
})

如何将属性传递给数据表以更改背景颜色 选择框和搜索框?

【问题讨论】:

  • 不要使用 Javascript 来做这个

标签: jquery datatables


【解决方案1】:

标题的外观取决于您使用的 CSS 主题(默认、jQueryUI、引导程序、基础),因此无法准确说明您需要什么颜色。但是要更改长度菜单和搜索框的background-color,请使用下面的 CSS 并将“红色”替换为您想要的颜色:

.dataTables_length select {
   background-color: red;
}
.dataTables_filter input {
   background-color: red;
}

演示 -> http://jsfiddle.net/rw27Lz11/

【讨论】:

  • 感谢您的建议
【解决方案2】:

下面的 css 修复了我的页面。 对于选择

.dataTables_wrapper 
     div.dataTables_wrapper 
         div.dataTables_filter select {
     color: white;
     background-color: red;
}

和标签

.dataTables_wrapper 
     .dataTables_length, div.dataTables_wrapper 
         div.dataTables_filter label, 
         div.dataTables_wrapper div.dataTables_info {
     color: white;
     background-color: red;
}

【讨论】:

    【解决方案3】:

    您可以在角度数据表的搜索输入字段中删除黑色轮廓

    1. 请在node_module文件中找到样式文件路径

    点赞:\node_modules\datatables.net-dt\css\jquery.dataTables.css

    1. 请找到路径“.dataTables_wrapper .dataTables_filter input{}”并添加更改

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-10-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-13
      • 2020-05-15
      • 1970-01-01
      相关资源
      最近更新 更多