Rails和< span>标签 [英] Rails and the <span> tag

查看:109
本文介绍了Rails和< span>标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Ruby on Rails相当陌生,我试图用滑动门技术创建一些奇特的CSS按钮。我几乎可以工作,但我觉得必须有一个更好的方式来处理链接的标签。

I'm fairly new to Ruby on Rails, and I'm attempting to create some fancy CSS buttons using the "sliding doors" technique. I have it almost working, but I feel like there has to be a better way to handle the tags for a link.

我目前的做法是:

 <%= link_to '<span>New car</span>', {:action => "new"}, :class=>"button" %> 

这其实并不可怕,但我想知道这是否是最好的方法来处理RoR中的span标签。

This isn't terrible, per se, but I would like to know if this is the best way to handle span tags in RoR.

推荐答案

另一种选择是这样的:

Another option is this:

<%= link_to content_tag(:span, 'New car'), {:action => "new"}, :class=>"button" %>

docs

这篇关于Rails和&lt; span&gt;标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆