开发者

HTML Rails View Format Question

开发者 https://www.devze.com 2023-01-16 13:19 出处:网络
How would I produce something like this in Rails ERB? <li><a href=\"portfolio.html\">Portfolio <span>Our work</span></a>

How would I produce something like this in Rails ERB?

<li><a href="portfolio.html">Portfolio <span>Our work</span></a>

My problem is that ruby won't allow me to span inside of the link.

<%= link_to 'portfolio', portfolio_path %>

Anyway to get the Our Works Span inside of that link?

Thanks in Advance.

Solved

<% link_to portfolio_path do %> Portfolio <span>Our开发者_Python百科 work</span> <% end %>


You could put the HTML string right in there like this:

<%= link_to 'Portfolio <span>Our work</span>', portfolio_path %>

Or, you can pass a block to enclose the link:

<% link_to portfolio_path do %>
Portfolio <span>Our work</span>
<% end %>


You can try something like this:


<%= link_to 'Porfolio <span>Our Work</span>', portfolio_path %>

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号