我們用Datatables經常會遇到這種情況,就是瀏覽器或者HTML里元素改變大小或分辨率后,標題就會出現不對齊現象。這種情況是因為Datatables框架中使用到serverSide : true,// 服務器查詢數據屬性,它會使Table標簽中多一個style="width:**px;"屬性,這就導致了變化大小時標題對不齊現象。
<table id="example" class="table table-border table-bordered table-bg table-hover table-sort"> <thead> <tr class="text-c"> <th width="25"> <input type="checkbox" name="checkAll" class="checkall" onclick="checkedClean();"> </th> <th width="100">名稱</th> <th width="100">說明</th> <th width="100">類型</th> <th width="60">是否默認</th> <th width="20">狀態</th> <th width="100"></th> </thead> <tbody> </tbody> </table>

解決方法
#example{ width: 100% !important; } 如果遇到設有橫向滾動條時,就固定設置Table寬度
#example{ width: ***px !important; } 收工,這樣就完美解決了!!

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。
|
新聞熱點
疑難解答