How to insert a line break inside the placeholder attribute of a text area with HTML?

Spread the love

Sometimes, we want to insert a line break inside the placeholder attribute of a text area with HTML.

In this article, we’ll look at how to insert a line break inside the placeholder attribute of a text area with HTML.

How to insert a line break inside the placeholder attribute of a text area with HTML?

To insert a line break inside the placeholder attribute of a text area with HTML, we use the 
 HTML entity.

For instance, we write

<textarea
  name="foo"
  placeholder="hello you&#10;Second line&#10;Third line"
></textarea>

to add &#10; between the lines to add the line breaks.

Conclusion

To insert a line break inside the placeholder attribute of a text area with HTML, we use the &#10; HTML entity.

Leave a Reply

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