如何在此代码中添加<div class="clearfix visible-lg-block visible-md-block visible-sm-block"></div>
?我遇到的问题是每个分页用户并不总是相同的高度,当高度关闭时,下一行会搞砸。我需要在每行之后将<div class="clearfix visible-lg-block visible-md-block visible-sm-block"></div>
插入代码中
<div class="row community">
<% @users.in_groups_of(3, false).each do |users| %>
<% users.each do |user| %>
<div class="col-md-4 col-sm-6 col-xs-6">
<div class="col-xs-12">
<center><p class="user-name"><%= link_to user.name, user %></p></center>
</div>
<div class="col-xs-4">
<div class="user-image">
<%= link_to image_tag(user.photo.thumb.url, class: "circular"), user %>
</div>
</div>
<div class="col-xs-8 community">
<ul class="name-head">
<li class="witty">
<%= user.profile %>
</li>
<% if current_user == user %>
<li class="update"><%= link_to "Update Your Bio", edit_user_path(current_user) %></li>
<% end %>
<li class="follow">
<% unless current_user == user %>
<%= render partial: "follow_form", locals: { user: user } %>
<% end %>
</li>
</ul>
</div>
<div class="col-xs-12">
<div class="following-list">
<div class="col-xs-4">
<a href="<%= following_user_path(user.id) %>">
<center><strong id="following" class:"stat">
<%= user.following.count %><br>
following
</strong></center>
</a>
</div>
<div class="col-xs-4">
<a href="<%= followers_user_path(user.id) %>">
<center><strong id="followers" class="stat">
<%= user.followers.count %><br>
followers
</strong></center>
</a>
</div>
<div class="col-xs-4">
<a href="<%= user_path(user.id) %>">
<center><strong id="photo-count" class="stat">
<%= user.photos.count %><br>
photos
</strong></center>
</a>
</div>
</div>
</div>
</div>
<% end %>
<% end %>
</div>
<%= will_paginate @users %>
答案 0 :(得分:0)
我认为这不可能使用bootstrap clearfix以及rails block functino / will_paginate。一些选项是:clearfix every nth child 或者将一个固定高度的css属性添加到包含div中,这将使它们具有相同的大小。