JQuery datatables 标题和内容居中显示

 1.如题,使用到了强大的表格插件datatables,要使标题和内容都居中显示,只需要在jsp引入css,写上如下内容即可:

[java] view plain copy
 
  1. /*qiulinhe:2016年11月7日13:48:26*/  
  2. /* dataTables列内容居中 */  
  3. .table>tbody>tr>td{  
  4.         text-align:center;  
  5. }  
  6.   
  7. /* dataTables表头居中 */  
  8. .table>thead:first-child>tr:first-child>th{  
  9.         text-align:center;  
  10. }  

       2.假如要设置表格某些列为特殊格式的话,你可以在th里面增加p,然后增加css样式,如下:

[java] view plain copy
 
    1. /* dataTables某些标题字体小一号,可以在标题<th><p>测试字体小一号</th>,就可以设置某些列特殊的样式 */  
    2. .table>thead:first-child>tr:first-child>th p{  
    3.         text-align:center;  
    4.         font-weight:normal;//字体粗细为正常  
    5. }  
原文地址:https://www.cnblogs.com/telwanggs/p/8611996.html