【问题标题】:horizantolly algin elements inside a well水平对齐井内的元素
【发布时间】:2016-03-03 03:57:49
【问题描述】:

我正在尝试对齐井内的元素,图像的位置发生了变化,导致井变大。我认为这个问题How to horizontally center a <div> in another <div>? 帮助我将商店的详细信息定位在正确的位置。但是图像导致了问题。

<% @stores.each do |store| %>
  <div class="row">
        <div class="well">
         <%= link_to image_tag(root_url + "/images/" + store.filename, size: "100x100", alt: store.filename), store %>
           <div id="inner">
            <h3><%=store.name%></h3>
            <h4><%=store.foodType%></h4>
            <p><%=store.description%></p>
            <% if current_user != store.user %>
            <%= rating_for store, "overall", :enable_half => true,:half_show => true,:disable_after_rate => false %>
            <% end %>
          </div>    
        </div>
      </div> 
    <% end %>

我觉得我需要一个专门用于我的图像的标签。但我不太确定如何设置它。

bootstrap.css

   #inner {
    padding: 50px;
    display: inline-block;
   }

【问题讨论】:

    标签: html css ruby-on-rails twitter-bootstrap


    【解决方案1】:

    只需将text-align: center; 赋予.well 即可使所有元素水平居中。

    .well{
         text-align: center;
    }
    

    Fiddle

    【讨论】:

    • 这很好,但不是我想要的。我需要我的图像在井的最左边。然后是一些空间。然后是商店描述:)
    • @A1X 你可以把margin-right: 20px;img。或者您可以根据需要增加和减少。
    • 请查看我的屏幕截图。这是我原来的:)
    • @A1X 那么,你现在想要什么?不是中心吗?
    • 我想搭上顶部的空间。井比需要的大:0。图像位置导致井变大。
    猜你喜欢
    • 2019-12-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-23
    • 2013-03-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多