css - 将排序箭头图标添加到表格 Bootstrap 4

标签 css twitter-bootstrap bootstrap-4

我正在尝试将这些很棒的字体排序图标添加到表格中,但它没有正确对齐。我也试过 ml-auto 但它没有正确对齐。

我想要的是,将箭头与单元格的右侧对齐。

如果您能提供任何帮助,我们将不胜感激。

实时代码:

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">

<div class="table-responsive shadow p-3 mb-5 bg-light rounded">
  <table id="grid" class="table table-hover sortable">
    <thead class="thead-dark">
      <tr>
        <th data-type="string">?</th>
        <th data-type="string"><i class="fas fa-sort text-right"></i>Socre:</th>
        <th data-type="number"><i class="fas fa-sort text-right"></i>Age:</th>
        <th data-type="number"><i class="fas fa-sort text-right"></i>Student:</th>
        <th class="wfixed" data-type="string">Status:</th>
      </tr>

    </thead>
  </table>
</div>

最佳答案

你能在标记中移动它们吗?如果是这样,只需将它们移动到文本的另一侧。

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">

<div class="table-responsive shadow p-3 mb-5 bg-light rounded">
  <table id="grid" class="table table-hover sortable">
    <thead class="thead-dark">
      <tr>
        <th data-type="string">?</th>
        <th data-type="string"></i>Score:<i class="fas fa-sort text-right"></th>
        <th data-type="number"></i>Age<i class="fas fa-sort text-right">:</th>
        <th data-type="number"></i>Student:<i class="fas fa-sort text-right"></th>
        <th class="wfixed" data-type="string">Status:</th>
      </tr>

    </thead>
  </table>
</div>

关于css - 将排序箭头图标添加到表格 Bootstrap 4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58313754/

相关文章:

javascript - CSS如何制作手拿着卡片的效果

jquery - Webkit Transition Left 功能不起作用 -- 解决一个 Fiddle

css - WooCommerce - 如何防止 Storefront 在子主题的样式表之后加载 woocommerce.css

html - 如何在此文本上设置填充或边距

jquery - 以编程方式触摸屏幕 phonegap

html - Bootstrap 菜单列表项下拉列表不是按钮

javascript - 在输入标签上使用 keyup 事件的 JS 搜索

javascript - 使用预编译模板创建页面

css - 从 Bootstrap 4 网格中删除装订线

html - Bootstrap 4 导航栏下拉淡入淡出效果在悬停时不起作用