The twitter bootstrap (3 and 4) documentation is pretty clear on how to handle a lot of different form input types. However, it lacks information on the recommended way to have an element for a “large” text input field. For example to type an email or letter in (preferably with a maximum character count).
What is the recommended way to handle this in bootstrap or in “modern” HTML/CSS in general?
2
Answers
Instead of using
input field
. I would recommend you usetextarea
Example
You can use jQuery to resize the
textarea
while typing.jQuery
Css
}
Demo
I think what you are looking for is the HTML
<textarea>
element. This can be used with Bootstrap like any other input element. Wrap it in aform-group
container and add the classform-control
to the textarea itself.Example
Unfortunately, the textarea element does not accept a
maxlength
argument like input fields. To use a maximum character count to need to handle this with javascript.