HTML CSS examples for HTML Tag:textarea
The textarea element creates a multiline text box.
The textarea Element summary
Item | Value |
---|---|
Element: | textarea |
Local Attributes: | name, disabled, form, readonly, maxlength, autofocus, required, placeholder, dirname, rows, wrap, cols |
Contents: | Text, which represents the content for the element |
Tag Style: | Start and end tag |
New in HTML5? | No |
Changes in HTML5 | The form, autofocus, required, placeholder, and wrap attributes are new in HTML5 |
Style Convention | None |
The rows and cols attributes set the dimensions of the textarea.
You can set the wrap attribute to hard or soft to control line breaks.
Using the textarea Element
<!DOCTYPE html> <html> <head> <title>Example</title> </head> <body> <form method="post" action="http://example.com/form"> <input type="hidden" name="recordID" value="1234"> <p> <label for="name"> Name: <!--from w w w . j a v a 2 s .c o m--> <input value="java2s.com" id="name" name="name"> </label> </p> <p> <label for="password"> Password: <input type="password" placeholder="Min 6 characters" id="password" name="password"> </label> </p> <p> <label for="fave" style="vertical-align:top"> Favorite Fruit: <select id="fave" name="fave"> <optgroup label="Top Choices"> <option value="CSS" label="CSS">CSS</option> <option value="HTML" label="HTML">HTML</option> </optgroup> <optgroup label="Others"> <option value="Oracle" label="Oracle">Oracle</option> <option value="Typescript" label="Typescript">Typescript</option> </optgroup> </select> </label> </p> <p> <textarea cols="20" rows="5" wrap="hard" id="story" name="story">Tell us why this is your favorite</textarea> </p> <input type="submit" value="Submit"> </form> </body> </html>