jquery.datatable.js中title怎么居中

沈宏朗
2023-12-01

这个插件做表格只需要有个table标签的id就行了

 <table id="data-table-list"
 class="table table-border table-bordered table-bg table-hover table-sort" 
 width="100%">
 </table>

使用下面这个时会自动判断是几行几列,但是title不居中
“columns”: [
{
render: function (data, type, row) {
return <input class="itemcheckbox checkbox" type="checkbox" value='${row.no_id}' name="">;
}
},
{
“title”: “ID”,
“data”: “no_id”,
},
{
“title”: “1标题”,
“data”: “title”,
render: function (data, type, row) {
return <span class='title${row.no_id}'>${data}</span>;
}
},
{
“title”: “发布时间”,
“data”: “dates”,
render: function (data, type, row) {
return <span class='dates${row.no_id}'>${data}</span>;
}
},
{
“title”: “操作”,
render: function (data, type, row) {
return <a style="text-decoration:none" class="ml-5" onClick='notice_edit(this,${row.no_id})' href="javascript:" title="编辑"><i class="Hui-iconfont">&#xe6df;</i></a> <a style="text-decoration:none" class="ml-5" onClick='notice_del(this,${row.no_id})' href="javascript:" title="删除"><i class="Hui-iconfont">&#xe6e2;</i></a>
}
}
]
直接复制代码设置css属性即可

<style>

    .table th {
        text-align: center;
    }
</style>
 类似资料: