我在rails上使用ruby创建了一个应用程序并使用了bootstrap,我使用的是2列布局,问题是帖子大小不平等,随后出现了一个尴尬的空白,我想摆脱它。
我的index.html.erb
<div class="container">
<% @posts.each_slice(2) do |posts| %>
<div class="posts-wrapper row">
<% posts.each do |post| %>
<div class="col-lg-4 col-md-offset-1">
<%= post.body %>
</div>
<% end %>
</div>
<% end %>
</div>
答案 0 :(得分:0)
将.row
移出循环,它将被修复
或尝试以下代码,这也应该有效
<div class="container">
<div class="posts-wrapper row">
<% @posts.each do |post| %>
<div class="col-lg-6">
<%= post.body %>
</div>
<% end %>
</div>
</div>
答案 1 :(得分:0)