php - 如何在html表格中创建水平滚动条?

标签 php jquery html css

<div class="row">
      <div class="col-sm-12">
        <div class="panel panel-default panel-table">
          <div class="panel-heading">Order History
          </div>
          <div class="panel-body">
            <table id="table2" class="table table-striped table-hover table-fw-widget">
              <thead>
                <tr>
                  <th>Date</th>
                  <th>Order ID</th>
                  <th>Service</th>
                  <th>Target</th>
                  <th>Quantity</th>
                  <th>Price</th>
                  <th>Status</th>
                  <th>Message</th>
                </tr>
              </thead>
              <tbody>
                <tr>
                    <td ><? echo $orderData['date'] ?></td>
                    <th ><? echo $orderData['oid'] ?></th>
                    <td><? echo $orderData['service'] ?></td>
                    <td><a href="http://nullrefer.com/?<? echo $orderData['link'] ?>"><font color="red"><? echo $orderData['link'] ?>...</font></a></td>
                    <td><? echo number_format($orderData['quantity'],0,',','.') ?></td>
                    <td>Rp <? echo number_format($orderData['price'],0,',','.') ?></td>
                    <td><button class="btn btn-rounded btn-space btn-<? echo $label ?> btn-xs"><?php echo $orderData['status'] ?></button></td>
                    <td><? echo $orderData['message'] ?></td>
                </tr>
            </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>

how to create horizontal scroll in html table? anyone can help?

I want the results similar to the one in this picture, where the slider is helpful :)

最佳答案

通过将 .table-responsive 添加到任何 .table 来创建响应式表格,使它们在小型设备(小于 768 像素)上水平滚动。在大于 768 像素宽的任何内容上查看时,您不会在这些表格中看到任何差异。

https://v4-alpha.getbootstrap.com/content/tables/#responsive-tables

<div class="row">
      <div class="col-sm-12">
        <div class="panel panel-default panel-table">
          <div class="panel-heading">Order History
          </div>
          <div class="panel-body">
            <table id="table2" class="table table-responsive table-hover table-fw-widget">
              <thead>
                <tr>
                  <th>Date</th>
                  <th>Order ID</th>
                  <th>Service</th>
                  <th>Target</th>
                  <th>Quantity</th>
                  <th>Price</th>
                  <th>Status</th>
                  <th>Message</th>
                </tr>
              </thead>
              <tbody>
                <tr>
                    <td ><? echo $orderData['date'] ?></td>
                    <th ><? echo $orderData['oid'] ?></th>
                    <td><? echo $orderData['service'] ?></td>
                    <td><a href="http://nullrefer.com/?<? echo $orderData['link'] ?>"><font color="red"><? echo $orderData['link'] ?>...</font></a></td>
                    <td><? echo number_format($orderData['quantity'],0,',','.') ?></td>
                    <td>Rp <? echo number_format($orderData['price'],0,',','.') ?></td>
                    <td><button class="btn btn-rounded btn-space btn-<? echo $label ?> btn-xs"><?php echo $orderData['status'] ?></button></td>
                    <td><? echo $orderData['message'] ?></td>
                </tr>
            </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>

关于php - 如何在html表格中创建水平滚动条?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48604395/

相关文章:

html - 如何在列表项之间插入换行符

php - 如何在jquery中获取数据库检索值?

php - php源码中三个大括号放在一起

javascript - 将 AJAX 数据绑定(bind)到 html 列表模板

javascript - 使用 AJAX 获取 MySQL 的 PHP 表单

css - 侧边菜单 div 高度不随主 div 延伸

php - Wordpress woocommerce 第二和第三产品图像模糊

php - 在 CakePHP Auth 中允许整个 Controller 并且 allow() 不起作用

jquery - 从一个 div 滚动到下一个时更改导航栏按钮的事件状态

javascript - 文本如何变得可点击?