将 CSS 类添加到 <%= f.submit %> [英] Add a CSS class to <%= f.submit %>

查看:21
本文介绍了将 CSS 类添加到 <%= f.submit %>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题很简单:

<%= f.submit %>

类声明去哪儿了?我多次尝试出错.

Where does the class declaration go? I'm getting errors on multiple attempts.

推荐答案

<%= f.submit 'name of button here', :class => 'submit_class_name_here' %>

应该可以.如果您收到错误消息,很可能是您没有提供名称.

This should do. If you're getting an error, chances are that you're not supplying the name.

或者,您可以在没有类的情况下设置按钮样式:

Alternatively, you can style the button without a class:

form#form_id_here input[type=submit]

也试试这个.

这篇关于将 CSS 类添加到 &lt;%= f.submit %&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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