【发布时间】:2014-06-19 11:47:46
【问题描述】:
我正在使用引导程序。
我有一个包含许多产品的产品网站。我需要为“店面”以网格格式显示我的产品。每个产品都有一张照片和一些信息。
我看到了 this 和 this 的帖子,但它们不是我想要的。
我正在尝试使用 product.each 迭代每个产品,同时尝试使用引导程序的网格系统。
随着时间的推移,我需要添加其他产品,因此需要每个产品从一排流到下一排。 我没有在 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>
【问题讨论】:
标签: html css ruby-on-rails twitter-bootstrap twitter-bootstrap-3