Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 引导类不使用select_Css_Ruby On Rails_Ruby_Twitter Bootstrap - Fatal编程技术网

Css 引导类不使用select

Css 引导类不使用select,css,ruby-on-rails,ruby,twitter-bootstrap,Css,Ruby On Rails,Ruby,Twitter Bootstrap,我正在开发RubyonRails应用程序,并试图减小select的大小。我已经为我的应用程序安装了“bootstrap gem”。 这是密码 <%= f.select :fromyear, (1995..Time.now.year).to_a.reverse, :include_blank => {:year => "Select year"}, :class=>"input-small" %> 正如我从这个问题中注意到的那样。但它似乎不适用于此选择

我正在开发RubyonRails应用程序,并试图减小select的大小。我已经为我的应用程序安装了“bootstrap gem”。 这是密码

 <%= f.select :fromyear, (1995..Time.now.year).to_a.reverse, 
     :include_blank => {:year => "Select year"}, :class=>"input-small" %>
正如我从这个问题中注意到的那样。但它似乎不适用于此选择。我试过了

<%= f.select :fromyear, (1995..Time.now.year).to_a.reverse, 
    :include_blank => {:year => "Select year"}, :style=>"100px" %>
但什么也没发生。
请让我知道我错过了什么。谢谢

也许您忘了在选项:样式中输入“宽度”

:style=>"width:100px"

也许你忘了在选项“样式”中输入“宽度”

:style=>"width:100px"
你试过这样吗

= a.input :country, :as => :select, :collection => country_code_localized_map, :include_blank => false, :input_html=>{:class => "reg-input"}
或者,您可以将另一个%DIV.select_添加到选择标记上方的\u类上,并通过上面的类应用样式以选择标记

.select_above_class select{
   // your css styles
}
你试过这样吗

= a.input :country, :as => :select, :collection => country_code_localized_map, :include_blank => false, :input_html=>{:class => "reg-input"}
或者,您可以将另一个%DIV.select_添加到选择标记上方的\u类上,并通过上面的类应用样式以选择标记

.select_above_class select{
   // your css styles
}
根据f的语法,在形式_中选择:

f、 selectmethod,choices=nil,options={},html_options={},&block

现在您正在传递include_blank和class as options参数,这就是为什么不应用该类的原因。类必须在TML_选项中

您只需将选项和html_选项分开即可:

根据f的语法,在形式_中选择:

f、 selectmethod,choices=nil,options={},html_options={},&block

现在您正在传递include_blank和class as options参数,这就是为什么不应用该类的原因。类必须在TML_选项中

您只需将选项和html_选项分开即可:

试试这个

<%= f.select(:fromyear, options_for_select((1995..Time.now.year).to_a.reverse), {:include_blank => 'Select year'}, { :class => 'input-small' }) %>
或者,您甚至可以将内联样式包含在带有

<%= f.select(:fromyear, options_for_select((1995..Time.now.year).to_a.reverse), {:include_blank => 'Select year'}, { :class => 'input-small', :style => 'width:200px;', required: true }) %>
试试这个

<%= f.select(:fromyear, options_for_select((1995..Time.now.year).to_a.reverse), {:include_blank => 'Select year'}, { :class => 'input-small' }) %>
或者,您甚至可以将内联样式包含在带有

<%= f.select(:fromyear, options_for_select((1995..Time.now.year).to_a.reverse), {:include_blank => 'Select year'}, { :class => 'input-small', :style => 'width:200px;', required: true }) %>

请告诉您使用简单表单或内置表单作为?@Monk\u代码我使用表单作为其他页面上的表单。在该视图上运行良好。请告诉您使用简单表单或内置表单作为?@Monk\u代码我使用表单作为其他页面上的表单。这一观点很好