我在带有引导程序的rails中.
我有一个产品网站,有很多产品.我需要以"网店前面"的网格格式显示我的产品.每个产品都有照片和一些信息.
我试图使用product.each迭代每个产品,同时尝试使用bootstrap的网格系统.
随着时间的推移,我将需要添加其他产品,因此需要每个产品从一行流到下一行.我没有在bootstrap之外使用任何额外的CSS样式.
截至目前,我看来每个产品都在下一行,并且每个产品都在它自己的列中,但是我为了调整图像或每个产品所在的div或col的任何尝试,一切都变得不对齐.
这是我的html.erb文件:
<div class="row">
<% @products.each do |product| %>
<div class="col-md-3">
<div id="storeimages">
<%= image_tag(product.image_url, class: "img-responsive") %>
<h3><%= product.title %></h3>
<div><%= sanitize(product.description) %></div>
<div><%= number_to_currency(product.price) %></div>
<%= button_to 'Add to Cart', line_items_path(product_id: product),
class: 'btn btn-info btn-sm', remote: true %>
</div>
</div>
<% end %>
</div>
Run Code Online (Sandbox Code Playgroud) html css ruby-on-rails twitter-bootstrap twitter-bootstrap-3