是否可以通过其标题大小(包括右对齐的glyphicon)自动调整列的大小?

例如。:

      <th class='autosize'>Col1 <span class='glyphicon glyphicon-sort pull-right' aria-hidden='true'></span></th>


和样式:

<style>
  .autosize {
    width: 1px;
    white-space: nowrap;
  }
</style>


将glyphicon推到第二列。

完整代码:

<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

  <style>
    .autosize {
      width: 1px;
      white-space: nowrap;
    }
  </style>
</head>
<body>
  <table class="table table-bordered" style="width: 1px;">
    <thead>
      <tr>
        <th class='autosize'>Col1 <span class='glyphicon glyphicon-sort pull-right' aria-hidden='true'></span></th>
      </tr>
    </thead>
  </table>
</body>
</html>

最佳答案

e,您总是花一些时间更改css来查看其工作原理,并且通过在此处发布信息来打开灯,我要做的就是从字形图标中删除右拉类

07-24 09:44
查看更多