更改表格行高 - Bootstrap

时间:2014-05-20 06:34:11

标签: html css twitter-bootstrap

我无法使用bootstrap更改表格行的高度。 我到目前为止的代码是:

    <table class="table table-bordered table-hover type-list2">
    <tr>  
      <th>#</th>
      <th>DSP Type</th>
      <th>Email</th>
      <th>Code Type</th>
      <th>Dispatch Time</th>
      <th>Codes</th>
    </tr>
    <tr>
      <td>2</td>
      <td>Email</td>
      <td>test@gmail.com</td>
      <td>7 Day</td>
      <td>2014-05-20 15:42:59</td>
      <td>6</td>
    </tr>
    <tr>
      <td>2</td>
      <td>Manual</td>
      <td>test@gmail.com</td>
      <td>12 Month</td>
      <td>2014-05-20 15:42:59</td>
      <td>
      WXJ79-P33MM-RX7BP-QHW86-AAAAA
      <br>HW382-6TPF3-RHV63-3W8QP-AAAAA
      <br>FHKV2-K376Y-3Q984-36C7C-AAAAA
      <br>RHXCM-KC24C-6B7T9-TBFB3-AAAAA
      <br>MD8QM-VXBQW-B72Q7-CR3BM-AAAAA
      <br>GXFGV-KX7TP-82H2H-DRFHM-AAAAA
      <br>VQV2F-P7VKM-MBBMB-M7JYC-AAAAA
      <br>KG4VD-HWGMM-6MJCT-G7PVC-AAAAA
      </td>
    </tr>

tr {
   max-height: 35px !important;
   height: 35px !important;
}

以下是代码的小提琴:http://www.bootply.com/xPgWHFFDah

1 个答案:

答案 0 :(得分:12)

解决方案是将div放入固定高度并溢出,如下所示:

<td>
  <div style="height: 50px; overflow:auto;">
      WXJ79-P33MM-RX7BP-QHW86-AAAAA
      <br>HW382-6TPF3-RHV63-3W8QP-AAAAA
      <br>FHKV2-K376Y-3Q984-36C7C-AAAAA
      <br>RHXCM-KC24C-6B7T9-TBFB3-AAAAA
      <br>MD8QM-VXBQW-B72Q7-CR3BM-AAAAA
      <br>GXFGV-KX7TP-82H2H-DRFHM-AAAAA
      <br>VQV2F-P7VKM-MBBMB-M7JYC-AAAAA
      <br>KG4VD-HWGMM-6MJCT-G7PVC-AAAAA
  </div>
</td>

查看更新后的from here