Css 使用引导对齐不同行上的多个表
我正在使用Twitter Bootstrap 2,在让表对齐方面遇到了一些问题 我在Rails应用程序中有一个视图,其中我想显示4个表-每行2个表(2 x 2),如下所示:Css 使用引导对齐不同行上的多个表,css,ruby-on-rails,twitter-bootstrap,Css,Ruby On Rails,Twitter Bootstrap,我正在使用Twitter Bootstrap 2,在让表对齐方面遇到了一些问题 我在Rails应用程序中有一个视图,其中我想显示4个表-每行2个表(2 x 2),如下所示: | table || table | | table || table | <% @most_popular_articles.in_groups_of(2).each do |article_array|%> <div class="row">
| table || table |
| table || table |
<% @most_popular_articles.in_groups_of(2).each do |article_array|%>
<div class="row">
<% article_array.each do |article| %>
<div class="span5">
<table class="table table-hover">
<thead>
<tr>
# header names
</tr>
</thead>
<tbody>
<% user.each do |user| %>
<tr>
# field values
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="span1"></div>
<%end%>
</div>
<%end%>
相反,我得到的是:
| table || table |
| table |
| table |
前两个表按照我想要的方式对齐,但是第三个表没有正确地水平对齐,我不知道为什么
# view
<div class="container">
<div class="row">
<%= render :partial=>"article_count", :locals=>{:most_popular_articles=>@most_popular_articles}%>
</div>
</div>
# _article_count
<% @most_popular_articles.each do |article| %>
<div class="span5">
<table class="table table-hover">
<thead>
<tr>
# header names
</tr>
</thead>
<tbody>
<% user.each do |user| %>
<tr>
# field values
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="span1"></div>
<% end %>
#查看
“文章数量”,:locals=>{:most\u popular\u articles=>@most\u popular\u articles}%>
#_物品_计数
#标题名称
#字段值
下面是一个示例,您可以看到它的外观,以及呈现的完整CSS和HTML。尝试以下操作:
| table || table |
| table || table |
<% @most_popular_articles.in_groups_of(2).each do |article_array|%>
<div class="row">
<% article_array.each do |article| %>
<div class="span5">
<table class="table table-hover">
<thead>
<tr>
# header names
</tr>
</thead>
<tbody>
<% user.each do |user| %>
<tr>
# field values
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="span1"></div>
<%end%>
</div>
<%end%>
#标题名称
#字段值