如何在 HAML 元素上添加 !important 到 CSS 属性

How to add !important to CSS attributes on HAML elements

2020年更新:这是一个旧的post,由于不清楚而被关闭。我想我一直在寻找的是如何在 HAML 中添加 !important 到 CSS 属性。

我的 Rails 应用程序有问题。我有这个代码:

= simple_form_for @post, html: { class: "newpost"}  do |f|
= f.input :title
= f.input :content
= f.submit :submit

它有效,但看起来不太好。我试图寻找答案,我发现您可以添加此代码:

= f.input :content, class: "name_of_class"

什么都不做。我现在一直在寻找答案。

谢谢。

PS:我也在使用 HAML 和 Rails 4

编辑: 这是它的外观图片:

当我在 Chrome 中添加 CSS 时,看起来就像我想要的那样:

但是,如果我尝试在代码中添加 CSS,则没有任何反应。

尝试从表单中删除 class newpost 并将表单与您的 newpost class 放在 div 中。我更喜欢将字段放在 div 中,并从 sass.

更改输入样式