How to wrap text inside input type=”text” element HTML and CSS?

Spread the love

Sometimes, we want to wrap text inside input type="text" element HTML and CSS.

In this article, we’ll look at how to wrap text inside input type="text" element HTML and CSS.

How to wrap text inside input type="text" element HTML and CSS?

To wrap text inside input type="text" element HTML and CSS, we use the word-wrsp and word-break properties.

For instance,, we write

<input type="text" value="The quick brown fox jumped over the lazy dog" />

to add an input.

Then we write

input[type="text"] {
  word-wrap: break-word;
  word-break: break-all;
  height: 80px;
}

to add word-wrap: break-word; to break wrap long lines if they overflow the input.

And we add word-break: break-all; to break long words if they overflow the input.

Leave a Reply

Your email address will not be published. Required fields are marked *