How to add a new line in text area element with CSS?

Spread the love

Sometimes, we want to add a new line in text area element with CSS.

In this article, we’ll look at how to add a new line in text area element with CSS.

How to add a new line in text area element with CSS?

To add a new line in text area element with CSS, we set the white-space attribute.

For instance, we write

textarea {
  white-space: pre-wrap;
}

to make new line characters show in the text area with white-space: pre-wrap;.

Conclusion

To add a new line in text area element with CSS, we set the white-space attribute.

Leave a Reply

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