0
所以我有一個div,這是應該做的寬度設置,另一個,這中心這裏面一個DataTable:數據表不居中而無法正常自動寬度
<div style='text-align:center !important'>
eakjflsdj
<div id="ajax_table_header" style="width: 60%;">
lbah
<table id="ajax_table">
<thead>
<tr>
<th>ID</th>
<th>Reference</th>
<th>Date</th>
<th>Title</th>
<th>Site</th>
<th>Location</th>
</tr>
</thead>
</table>
</div>
</div>
文本中心預期,但當我改變 <div id="ajax_table_header" style="width: 60%;">
到 <div id="ajax_table_header" style="width: auto;">
就好像沒有應用CSS。
而當我<table id="ajax_table" style="width: auto">
只有表縮小到其可管理的大小,而搜索欄,分頁和其他一切繼續延伸到div的邊緣。
我能做些什麼來居中和自動調整大小?
的jsfiddle:https://jsfiddle.net/nc45tz0d/1/
在ajax_table_header
多少擺弄周圍display: table
後似乎是解決