I know this question has been asked but I cant find the solution to it.
This is my tag :
<input type="text" id="userText" class="userTextBox">
and this is my css :
.userTextBox {
/* Add some margin below the input element */
margin-bottom: 20px;
width: 500px;
height: 100px;
overflow-wrap: break-word;
}
but overflow-wrap or word-wrap dont work.
I tried overflow-wrap,word-wrap and word-break. But they dont work.
2
Answers
<input>
is an inline element and as such also only allows a single-line text. If you need a multi-line text input you need a block-level input which is calledtextarea
. It does exactly what you try to do by default:<input>
is a single line text input.But
<textarea>
is a multiple line.Here you only need to change the to in html.
<textarea id="userText" class="userTextBox"></textarea>
And in css remove
overflow-wrap: break-word;
and if you don’t need to add the feature to resize, you can addresize: none;