Can I use link_to to link an image and a text

前端 未结 5 859
自闭症患者
自闭症患者 2020-12-31 21:03

Well, I am using \"font-awesome-rails\" gem. I am pretty much used to font-awesome outside Rails, but I guess it\'s not that popular among Rails community.

Once inst

5条回答
  •  长情又很酷
    2020-12-31 21:51

    Yes, you are using a vector font as image but you can use image_tag too, for example:

    <%= link_to user_root_path, :class=> "user" do
          image_tag("image.jpg", :alt => current_user.name) +
          t("dashboard.my_account")
        end %>
    

    Don't forget link together both of them with "+"

提交回复
热议问题