我們用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; }
收工,這樣就完美解決了??!
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com