简体   繁体   English

如何在simple_form中调整文本框的高度?

[英]How do you resize a text box height in simple_form?

I can figure out how to change the text box height with simple_form. 我可以弄清楚如何使用simple_form更改文本框的高度。 Do i need to modifiy the css? 我需要修改CSS吗?

here is my code 这是我的代码

``` ```

.well/
= simple_form_for @document do |f|
  = f.input :title
  = f.input :content, :input_html => {:rows =>10} 
  = f.button :submit 

``` ```

你可以这样

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

简单修复,将输入更改为文本区域

= f.text_area :content, :input_html => {:rows => 10} 

You will need to tell simple_form that you are using a text_box, like this and it will work: 您将需要像这样告诉simple_form您正在使用text_box,它将起作用:

haml HAML

= f.input :content, as: :text, input_html: {rows: 9}

html HTML

<%= f.input :content, as: :text, input_html: {rows: 9} %>

Hope it helps :) 希望能帮助到你 :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在simple_form中处理人员身高? - How do I handle person height within a simple_form? 你如何使枚举与simple_form一起工作? - how do you make enums work with simple_form? 您如何使用 Bootstrap 5 和 simple_form 编写切换开关 - How do you write a toggle switch with Bootstrap 5 and simple_form 无法更改simple_form中文本字段的高度 - can't change the height of a text field in simple_form Formtastic 和 simple_form 如何比较? - How do Formtastic and simple_form compare? 你如何让simple_form使用urls的基类而不是子类? - How do you get simple_form to use the base class for urls and not the subclass? 如何使simple_form时区的值对postgres有效 - How do you make simple_form timezone have values which are valid for postgres 如何将simple_form与嵌套的ActiveModel对象(而不是ActiveRecord)一起使用? - How do you use simple_form with nested ActiveModel objects (not ActiveRecord)? 如何使用Rails,Simple_Form和Cocoon创建部分预填充的表单? - How do you create partially pre-filled forms with Rails, Simple_Form, and Cocoon? 如何使下拉菜单中的每个选项成为具有关联simple_form调用的链接? - How do you make each option in a drop down menu a link with the association simple_form call?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM