加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 带图像的按钮?

发布时间:2020-12-17 02:11:19 所属栏目:百科 来源:网络整理
导读:嘿家伙我正在尝试创建一个带图像的按钮.所以基本上,我需要下面代码的button_to版本:| %= link_to image_tag(product.image_url,:class = "img"),line_items_path(:product_id = product) % 解决方法 这是我的解决方案: 使用按钮助手(您可以使用button_to助
嘿家伙我正在尝试创建一个带图像的按钮.所以基本上,我需要下面代码的button_to版本:|

<%= link_to image_tag(product.image_url,:class => "img"),line_items_path(:product_id => product) %>

解决方法

这是我的解决方案:

使用按钮助手(您可以使用button_to助手方法):

<%= f.submit 'Save',:class => "button_with_image_save" %>

CSS:

.button_with_image_save {
    background: url(../images/icons/page_save.png) #f2efa8 no-repeat 10px 6px;
    text-indent:30px;
    display:block;
    cursor: pointer;
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读