1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Rails】f.text_areaのサイズ指定の仕方【Bootstrap】

Posted at

結論

<div class="form-label"> 
  <%= f.text_area :content, class: "form-control", style: "width:40%", rows: "3" %>
</div>

解説

  • 親要素にform-labelのクラスを付与する。
    form-floatingクラスだとrowsの指定が出来ない。

  • text_areaform-controlのクラスを付与する。

  • text_area内でstyle: "width:XX%"rows: "X"を指定する。

注意

属性の付与は○○:といったシンボルの形式を指定すること。
,class="{任意の値}"のような形式を追加すると下記のようなエラーメッセージとともにバグが発生する。

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: https://www.ruby-lang.org/bugreport.html

[IMPORTANT]
Don't forget to include the Crash Report log file under
DiagnosticReports directory in bug reports.

参考

Bootstrap5 公式リファレンス #Form Control

Bootstrap3 formテキストフィールド横幅の指定の仕方

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?