我想顯示圖像,圖像下有時間到左邊,在同一行右邊有一個註釋的計數。不幸的是,我的評論數量出現在圖片的右上角。用引導拉動右對齊文字
<% @articles.each do |article| %>
<div class="well well-sm">
<%= image_tag(article.attachments.first.attachment_url, class: "picture") %>
<span class="flag pull-right"><i class="glyphicon glyphicon-comment")></i> <span class="badge">5</span></span>
<h6>
Posted by: Administrator
<%= time_ago_in_words(article.created_at) %> ago.
</h6>
<p class="lead"><%= article.title %></p>
<%= simple_format(article.content[0,300]) %>
<%= link_to "More", article_path(@article) %>
</div>
<% end %>
將'img'標籤包裹在'div'中 –
謝謝。這是因爲
在使用拉右時用作分隔符嗎? – DercniIMG元素是內聯的,這意味着除非它們被浮動,否則它們將與文本和其他內聯元素水平流動。而'DIV'是塊級元素:塊級元素總是從新行開始並佔用全部可用的寬度。 –