Rails 3 - 引用一个CSS类来形成对象点样式中的元素 [英] Rails 3 - Referencing a CSS class to form elements in an Object Dot Style

查看:117
本文介绍了Rails 3 - 引用一个CSS类来形成对象点样式中的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我在下面的f表单对象的两个表单元素添加一个CSS类的语法吗?

Can someone please show me the syntax for adding a CSS class to the two form elements of the "f" form object below?

指向特定文档的链接也可以。我找到了select_box的东西,但没有为下面显示的表单元素。

A link to the specific documentation is OK, too. I found stuff for select_box but nothing for the form elements shown below.

 ## A view...
 <div id="email_label">
        <%= f.label :password %>
        <%= f.password_field :password %>
    </div>


推荐答案

<%= f.label :password, :class => "myCSSclass" %>

您可以执行上述操作。希望它有帮助。

You could do something like the above. hope it helps.

将CSS文件放在 app / assets / stylesheets /< cssFileName.css>

这篇关于Rails 3 - 引用一个CSS类来形成对象点样式中的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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