Rails Simpleform setting the width of a form input element

我是研究僧i 提交于 2019-12-07 09:53:18

问题


I'm using the gem simpleform inside a table

I want to adjust the width of each form element of the simple form can I do that?

I tried the following but it doesn't seem to work

    <td><%= listing.name %></td>
<td><%= f.input :suite, :input_html => { :size => 10, :maxlength => 10 } %></td>

I looked at the simpleform documentation here but couldn't find how to specifically set the width. Here is what my form inside a table looks like. I'd like to make the columns narrower.

As you can see the column widths are very wide. Please advise how to make them the appropriate size so they don't take too much space.


回答1:


I've used <%= f.input :fieldname, :input_html => {:maxlength =>2,:style=> 'width: 20px'}%> with success. Are you suppressing all labels? (via :label=>false)?



来源:https://stackoverflow.com/questions/11025074/rails-simpleform-setting-the-width-of-a-form-input-element

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!