[英]Ruby on Rails, how to make image tag
我試圖放置圖像,當我點擊圖像去例如for_rent_index_path(視圖中的女巫)時,我有這樣的:
`<%= link_to "For rent", forrent_index_path %><br/>`
並且工作但沒有形象。 我想刪除它並放置帶標簽的圖像
我怎么能這樣做?
您只需要將圖像標記用作鏈接中的第一個參數。
<%= link_to (image_tag "image.jpg"), forrent_index_path %><br/>
<%= link_to(image_tag("image.jpg", :alt => "image", :width => 50, :height => 50, :title => "Click here") forrent_index_path) %>
嘗試這個
link_to image_tag('/images/image.png') + "some text", url_for({:controller => 'controller_name', :action => 'action_name'}), :class => 'some class', :remote => true %>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.