我在fields_for
中有一个text_area
,它在form_for
中。
<%= day_form.text_area :hatch %>
是否可以更改text_area
的大小?例如:day_form.text_area size: 5
。
发布于 2010-11-19 18:09:09
你可以选择:
<%= day_form.text_area :hatch, cols: 30, rows: 10 %>
或者,您可以使用size属性同时指定这两个属性:
<%= day_form.text_area :hatch, size: "30x10" %>
发布于 2016-09-26 23:42:25
为了提高响应速度,我喜欢将文本区域的宽度设置为100%:
<%= f.text_area :description, rows: 10, style: 'width:100%;' %>
发布于 2010-11-19 18:09:16
由于文本区域既有行又有列,因此必须同时指定行和列
<%= text_area(:application, :notes, cols: 40, rows: 15, class: 'myclass') %>
对于文本字段,可以使用
<%= text_field(:application, :name, size: 20) %>
http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-text_area
https://stackoverflow.com/questions/4223931
复制相似问题