Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
345 views
in Technique[技术] by (71.8m points)

javascript - 为什么数据表的标题与内容未对齐?(Why the header of datatable misaligned with the content?)

I have a datatable that th header misaligned with the content.

(我有一个数据表,标题与内容未对齐。)

Please help me to adjust the header and content so that parallel.

(请帮我调整标题和内容,使之平行。)

Because it look

(因为看起来)

]([![图片

<div style="margin-top:10px; padding: 10px;">
  <table id="example" class="table display nowrap table-bordered table-striped" style="width:100%;">
    <thead>
      <tr>
        <th>Test1</th>
        <th>Test2</th>
        <th>Test34567</th>
        <th>Test890</th>
      </tr>
    </thead>
    <tbody>
      <td>A</td>
      <td>B</td>
      <td>C</td>
      <td>D</td>
    </tbody>
  </table>
</div>
$(document).ready(function() {
  $('#example').DataTable({
    scrollX: true
  });
});
  ask by Questioning People translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I think you are missing your <tr></tr> around your <td></td> .

(我认为您在<td></td>周围缺少了<tr></tr> <td></td> 。)

    <tbody>
        <tr>
           <td>A</td>
           <td>B</td>
           <td>C</td>
           <td>D</td>
        </tr>
    </tbody>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...