Forms: textarea - A Smarter Way To Learn HTML & CSS (2015)

A Smarter Way To Learn HTML & CSS(2015)

51
Forms: textarea

In the last chapter you learned how to code a one-line text box using input type="text". Here’s a second type of control, a multi-line text box. (In this example form I haven’t included a first-name field. This example form is only for learning, so we’ll limit it to just one control of each type.)

This is the HTML.

<form action="send-email.php" method="post">
Last name:
<br>
<input type="text" name="surname" size="25" maxlength="40">
<br><br>
Message:
<br>
<textarea name="message" rows="4" cols="30"></textarea>
</form>

Notice, first, that this tag is closed, with </textarea>.

rows="8" cols="30" specifies the number of visible rows and columns. By default, entered text will scroll if the user types beyond the specified number of rows. By default, the field can be resized by the user when she drags the lower-right corner with the mouse.

In your HTML file add a text area to the form you’ve already coded. Specify rows and columns. Save the file. Display the page.

Sample HTML code is at:
http://asmarterwaytolearn.com/htmlcss/practice-51-1.html.

Find the interactive coding exercises for this chapter at:
http://www.ASmarterWayToLearn.com/htmlcss/51.html