Skip to content Skip to sidebar Skip to footer

HTML Input Wrap Text Instead Of Overflow Horizontally

I have an input field, in which a user will enter text inside. When the text becomes too long, the input field extends horizontally instead of dropping down vertically. I tried add

Solution 1:

I think you should use a multiline input field as TextArea:

http://htmlhelp.com/reference/html40/forms/textarea.html

Sample code:

<textarea rows="10" cols="30"></textarea> 

Solution 2:

Xtian - You shouldn't have any restriction on where you need to use an <input> or a <textarea>. Just give the text area the same name that you would've used for the input and you'll be fine.

For example, I just replaced

<input type="text" name="reply" />

With

<textarea rows="1" cols="26" name="reply"></textarea>

Much better now.


Solution 3:

This is a soultion i found, Just use a hidden input and use a button for the text with a action for the form.

<form method="post" action="nextpage.php">

    <input style="display: none;" name="name" type="text" value=“somedata"></input>

    <button>Some text that you want to wrap but also submit the form </button>

</form>

Post a Comment for "HTML Input Wrap Text Instead Of Overflow Horizontally"