我用 Google 搜索过,但找不到这个问题的答案。我如何使用 CSS 编辑 erb 中的 RUby 对象。例如:
<%= f.label :email, "Enter your email address for updates" %><br />
<%= f.text_field :email %>
在这里,我想使用 CSS 来设置文本和表单框的样式。我该怎么做?
最佳答案
您可以使用 :class
选项来指定 CSS 类:
<%= f.text_field :email, :class => "login" %>
然后将其放入您的 CSS 中:
input.login {
color: red;
}
此外,如果需要,您可以指定内联 CSS:
<%= f.text_field :email, :style => "color: red;" %>
关于ruby-on-rails - 使用 CSS 为 erb 中的 Ruby 对象设置样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5108114/