无法更改simple_form中文本字段的高度 [英] can't change the height of a text field in simple_form

查看:97
本文介绍了无法更改simple_form中文本字段的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试过

  #Default size for text inputs.  
  config.default_input_size = 10

来自config/initializers/simple_form.rb

from config/initializers/simple_form.rb

我也尝试过<%= f.input :message, :input_html => {:size => 10} %>

但是这些都没有改变我的文本字段显示方式.

But neither of these change a single thing about how my text fields appear.

推荐答案

您需要这样做

<%= f.input :message, :input_html => {:rows => 10} %>

HTML文本区域标签属性具有两个属性,即rowscols,可用于指定文本区域的行数和列数(即宽度).如果这不起作用,请打开控制台,然后查看您的CSS是否覆盖了高度.

Html text area tag attributes has two attributes namely rows and cols which lets you specify the no of rows and columns(i.e. width) of your text area. If this is not working then open the console and see if your css is overriding the height.

这篇关于无法更改simple_form中文本字段的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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