【问题标题】:Twitter Bootstrap Column Headers won't centerTwitter Bootstrap 列标题不会居中
【发布时间】:2015-06-21 16:51:45
【问题描述】:

<table class="table table-striped table-bordered">
  <thead>
    <tr>
      <th><%= model_class.human_attribute_name(:id) %></th>
      <th><%= model_class.human_attribute_name(:projectid) %></th>
      <th><%= model_class.human_attribute_name(:ppiho) %></th>
      <th><%= model_class.human_attribute_name(:needby) %></th>
      <th><%= model_class.human_attribute_name(:quantity) %></th>
      <th><%= model_class.human_attribute_name(:model) %></th>
      <th><%= model_class.human_attribute_name(:prnum) %></th>
      <th><%= model_class.human_attribute_name(:ponum) %></th>
      <th><%= model_class.human_attribute_name(:status) %></th>
      <th><%= model_class.human_attribute_name(:contact) %></th>
      <th><%= model_class.human_attribute_name(:notes) %></th>
      <th><%= model_class.human_attribute_name(:created_at) %></th>
      <th><%=t '.actions', :default => t("helpers.actions") %></th>
    </tr>
  </thead>
  <tbody>
    <% @orders.each do |order| %>
      <tr>
        <td align="center"><%= link_to order.id, order_path(order) %></td>
        <td align="center"><%= order.projectid %></td>
        <td align="center"><%= order.ppiho %></td>
        <td align="center"><%= order.needby %></td>
        <td align="center"><%= order.quantity %></td>
        <td align="center"><%= order.model %></td>
        <td align="center"><%= order.prnum %></td>
        <td align="center"><%= order.ponum %></td>
        <td align="center"><%= order.status %></td>
        <td align="center"><%= order.contact %></td>
        <td align="center"><%= order.notes %></td>
        <td align="center"><%=l order.created_at %></td>
        <td>
          <%= link_to t('.edit', :default => t("helpers.links.edit")),
                      edit_order_path(order), :class => 'btn btn-default btn-xs' %>
          <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
                      order_path(order),
                      :method => :delete,
                      :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
                      :class => 'btn btn-xs btn-danger' %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>

虽然我可以让实际的表格数据居中,但无论我尝试将标题居中如何,它都会拒绝。我需要把这些事情集中起来。如果有人有任何想法,我将不胜感激。

如果我能让它们居中,我可以继续尝试让标题冻结。

【问题讨论】:

    标签: twitter-bootstrap twitter header centering


    【解决方案1】:

    我已经解决了这个问题;我很密集。您可以使用与我在另一篇文章中找到的 td 相同的 css 对齐 th >.

    .table td {
       text-align: center;   
    }
    

    也适用于 th。

    .table th {
       text-align: center;   
    }
    

    【讨论】:

      猜你喜欢
      • 2018-09-01
      • 2013-08-11
      • 2017-05-31
      • 2019-05-01
      • 2012-12-25
      • 2013-08-14
      • 1970-01-01
      • 2013-08-04
      • 2012-06-11
      相关资源
      最近更新 更多