Rails Simpleform设置表单输入元素的宽度 [英] Rails Simpleform setting the width of a form input element

查看:91
本文介绍了Rails Simpleform设置表单输入元素的宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在表格中使用gem simpleform

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>

我在这里查看了simpleform文档,但找不到如何专门设置宽度。这里是我在表格内的形式看起来像。我想让列更窄。

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.

推荐答案

我使用了<%= f.input:fieldname,:input_html => {:maxlength => 2,:style => 'width:20px'}%> 。您是否压缩所有标签? (通过:label => false )?

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

这篇关于Rails Simpleform设置表单输入元素的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆