如何将(a href)转换为<%= link_to%>?
此代码可以使用,但我不需要它。
<li><a href="users"><span>User</span></a></li>
我需要使用&lt;%= link_to%&gt;来修改代码。但我希望这些风格没有消失。
<li><%= link_to user_path %></li>
式
#mainNav a:active{
top:1px;
}
#mainNav a:hover span ,
#mainNav li.active span {
background-image: linear-gradient(bottom, rgb(71,83,101) 0%, rgb(123,145,177) 100%);
background-image: -o-linear-gradient(bottom, rgb(71,83,101) 0%, rgb(123,145,177) 100%);
background-image: -moz-linear-gradient(bottom, rgb(71,83,101) 0%, rgb(123,145,177) 100%);
background-image: -webkit-linear-gradient(bottom, rgb(71,83,101) 0%, rgb(123,145,177) 100%);
background-image: -ms-linear-gradient(bottom, rgb(71,83,101) 0%, rgb(123,145,177) 100%);
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0, rgb(71,83,101)),
color-stop(1, rgb(123,145,177))
)
}
答案 0 :(得分:1)
为了在erb
中准确输出原始html
中的内容,您可以使用以下内容:
<li>
<%= link_to user_path do %>
<span>User</span>
<% end %>
</li>
答案 1 :(得分:0)
更新它: -
<li id="mainNav"><%= link_to "Users", users_path %></li>
<强>式强>
#mainNav a:active{
top:1px;
}
#mainNav a:hover ,
#mainNav li.active {
background-image: linear-gradient(bottom, rgb(71,83,101) 0%, rgb(123,145,177) 100%);
background-image: -o-linear-gradient(bottom, rgb(71,83,101) 0%, rgb(123,145,177) 100%);
background-image: -moz-linear-gradient(bottom, rgb(71,83,101) 0%, rgb(123,145,177) 100%);
background-image: -webkit-linear-gradient(bottom, rgb(71,83,101) 0%, rgb(123,145,177) 100%);
background-image: -ms-linear-gradient(bottom, rgb(71,83,101) 0%, rgb(123,145,177) 100%);
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0, rgb(71,83,101)),
color-stop(1, rgb(123,145,177))
)
}