作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何更改颜色行列“受众名称”?
我想将文本“一、二、三、四”更改为带下划线的蓝色。
该怎么做?我只想更改“受众名称”行列的颜色,而不是所有行。
jQuery :
$(document).ready(function() {
var tabble = $('#table1').dataTable({
"ajax": "https://api.myjson.com/bins/sk48v",
"columns": [{
"data": "name"
}, {
"data": "subtype"
}, {
"data": "approximate_count"
}, {
"data": "time_created"
}],
"order": [4, "desc"],
"bStateSave": true,
"stateSave": true,
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bInfo": false,
"bAutoWidth": false
});
});
table.dataTable tbody th, table.dataTable tbody td {
color: blue;
padding: 8px 10px;
text-decoration: underline;
cursor: pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<link href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css" rel="stylesheet"/>
<table id="table1" class="table table-bordered table-hover">
<thead>
<tr>
<th>Audience Name</th>
<th>Type</th>
<th>Size</th>
<th>Date Created</th>
</tr>
</thead>
</table>
Not working on the snippet demonstration
最佳答案
您可以像这样在列对象中使用 className
属性
JavaScript
$(document).ready(function() {
var tabble = $('#table1').dataTable({
"ajax": "https://api.myjson.com/bins/sk48v",
"columns": [{
"data": "name",
"className": "blue"
}, {
"data": "subtype"
}, {
"data": "approximate_count"
}, {
"data": "time_created"
}]
});
});
HTML
<table id="table1" class="table table-bordered table-hover">
<thead>
<tr>
<th>Audience Name</th>
<th>Type</th>
<th>Size</th>
<th>Date Created</th>
</tr>
</thead>
</table>
CSS
.blue {
color: blue;
text-decoration : underline;
}
这是工作 JSFIDDLE
关于javascript - 如何更改所选行列数据表的字体颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47976517/
我正在尝试用 Swift 编写这段 JavaScript 代码:k_combinations 到目前为止,我在 Swift 中有这个: import Foundation import Cocoa e
我是一名优秀的程序员,十分优秀!