[英]How do I combine a link and image in ruby and rails using gem gravatar
I have a separate link and image 我有一个单独的链接和图片
<li><%= link_to "Log Out", destroy_user_session_path %><li>
<li><%= image_tag current_user.gravatar_url, style: "max-width: 100%;height:50px;display:inline-block;border-radius:75%;"%>
</li>
and I would like to combine them to one image link. 我想将它们组合成一个图像链接。
If you want to combine both "Log Out" text and image as a single link, then you can write your code in this format: 如果要将“注销”文本和图像都合并为一个链接,则可以使用以下格式编写代码:
<li>
<%= link_to destroy_user_session_path do %>
"Log Out"
<%= image_tag current_user.gravatar_url, style: "max-width: 100%;height:50px;display:inline-block;border-radius:75%;"%>
<% end %>
</li>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.