
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML wrap Attribute
The HTML wrap attribute defines how the text in a text area is to be wrapped when a form is submitted in an HTML document.
Syntax
Following is the syntax −
<textarea wrap=”hard | soft”></textarea>
Let us see an example of HTML wrap Attribute −
Example
<!DOCTYPE html> <html> <style> body { color: #000; height: 100vh; } .btn { background: #db133a; border: none; height: 2rem; border-radius: 2px; width: 40%; display: block; color: #fff; outline: none; cursor: pointer; margin: 1rem 0; } .show { font-size: 1.5rem; margin: 1rem 0; } </style> <body> <h1>HTML wrap Attribute Demo</h1> <form action='' method="post"> <textarea rows="5" cols="28" wrap="soft">Hi! I'm a text area element with some dummy text.</textarea> <input type="submit" class='btn' value="Submit Form"> </form> <button onclick="set()" class="btn">Show wrap value</button> <div class="show"></div> <script> function set() { document.querySelector('.show').innerHTML = "The value of wrap attribute is " + document.querySelector("textarea").wrap; } </script> </body> </html>
Output
Click on “Show wrap value” button to display the value of wrap attribute of the textarea element:
- Related Articles
- HTML DOM Textarea wrap Property
- HTML pattern Attribute
- HTML novalidate Attribute
- HTML maxlength Attribute
- HTML disabled Attribute
- HTML for Attribute
- HTML min Attribute
- HTML disabled Attribute
- HTML disabled Attribute
- HTML min Attribute
- HTML draggable Attribute
- HTML href Attribute
- HTML max Attribute
- HTML enctype Attribute
- HTML for Attribute

Advertisements