2

我正在使用引导程序。我正在尝试使用固定的表头,但它不是固定的,它可以滚动。我不想要scroll一个表头,我想要一个固定的 表头。请帮我修复它。

这是我的代码示例:

这是我的代码:

  <div class="widget-content">
          <div class="container">
            <table class="table table-bordered">
              <thead>
              <th class="text-center"> my</th>
              <th class="text-center"> text / line</th>
              <th  class="text-center">caps/ lock</th>
              <th  class="text-center">Value</th>
              <th  class="text-center">Qty</th>
              <th  class="text-center">other</th>
              </thead>
              <tbody>

                <tr class="dt-picked">
                  <td class="text-center">
                      <span style="color:white; font-weight:bold;"> text</span>

                  </td>
                  <td class="text-center">
                    <p>text</p>

                  </td>
                  <td class="text-center ">
                    <p>text</p>
                   <p>text</p>
                  </td>
                  <td class="text-center"> <p>text</p></td>
                  <td class="text-center b-color-1"><p>text</p></td>
                  <td>
                    class="btn btn-mini btn-danger" role="button">Sell</a>
                  </td>
                </tr>

              <tr>
                <td colspan="4" class="text-right no-stripe">Total Cash</td>
                <td class="b-color-1"><p>text</p></td>
              </tr>
              <tr>
                <td colspan="4" class="text-right no-stripe">Total Invested</td>
                <td class="b-color-1"><p>text</p></td>
                <td colspan="2" class="no-stripe"></td>
              </tr>
              <tr>
                <td colspan="4" class="text-right bold no-stripe">Bottom Line</td>
                <td class="b-color-1 bold"><p>text</p></td>
                <td colspan="2" class="no-stripe"></td>
              </tr>
              </tbody>
            </table>
          </div>
        </div> 
4

2 回答 2

2

我为你准备了一把小提琴

<thead>
    <tr class="header">
      <th>
        Table attribute name
        <div>Table attribute name</div>
      </th>
      <th>
        Value
        <div>Value</div>
      </th>
      <th>
        Description
        <div>Description</div>
      </th>
    </tr>
  </thead>

https://jsfiddle.net/byB9d/14995/

于 2017-07-31T04:53:48.057 回答
0

尝试在头上使用 position 属性

 <thead style="position:absolute;">
              <th class="text-center"> my</th>
              <th class="text-center"> text / line</th>
              <th  class="text-center">caps/ lock</th>
              <th  class="text-center">Value</th>
              <th  class="text-center">Qty</th>
              <th  class="text-center">other</th>
              </thead>
于 2017-07-31T04:17:55.693 回答