【发布时间】:2014-05-05 19:54:28
【问题描述】:
我正在尝试使用带有 formtastic 和 haml 的 ruby on rails 构建一个表单。一切正常,除了我无法在我的输入字段上设置内联样式。当文本框设置为只读时,我想将其变灰。我成功地将字段设置为只读,但样式标签不起作用。在演示站点上查看时,它实际上并没有显示在代码中。
如何使用 haml 设置内联样式?
= semantic_form_for @article do |f|
= f.inputs do
= f.input :id, "style" => "background-color:#000000", input_html: { readonly: true }
根本不工作的代码是:
"style" => "background-color:#000000",
我一直在看这里:http://haml.info/docs/yardoc/file.REFERENCE.html#htmlstyle_attributes_
但我一直无法弄清楚。我还是个新手!你能帮忙吗?
【问题讨论】:
-
请注意,我确实尝试使用以下措辞 ---> "style" => "background-color:#000000" ||没有不同的结果
标签: ruby-on-rails haml