HTML <textarea> with wrap Attribute

HTML <textarea> with wrap Attribute

The wrap attribute specifies how to wrap the text in a textarea, when a form is submitted.

soft

The actual text is still on the same line but looks like it's divided into several lines.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <form action="/textarea-wrap.php"> <textarea cols="25" rows="5" name="desc" wrap="soft"></textarea> <input type="submit"> </form> </body> </html>

Attribute Value

ValueExplanation
softDefault. The actual text is still on the same line but looks like it's divided into several lines.
hardThe browser automatically inserts line breaks so that each line has no more than the width of the control.
Here, the cols attribute must also be specified for this to take effect.
offThe browser will automatically adds the horizontal scrollbar and it will not break the words as like wrap="soft".

hard

The browser automatically inserts line breaks so that each line has no more than the width of the control.

Note: The cols attribute must also be specified for this to take effect.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <form action="/textarea-wrap.php"> <textarea cols="25" rows="5" name="desc" wrap="hard"> </textarea> <input type="submit"> </form> </body> </html>

off

The browser will automatically adds the horizontal scrollbar and it will not break the words as like wrap="soft".

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <form action="/textarea-wrap.php"> <textarea cols="25" rows="5" name="desc" wrap="off"></textarea> <input type="submit"> </form> </body> </html>

Reminder

Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in HTML.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Meet the Author