Week 6: More Form Controls
Expand your form-building skills with checkboxes, radio buttons, dropdowns, and more.
Explore Chapter 6Text Areas (<textarea>)
The <textarea> element defines a multi-line text input control, suitable for longer messages or comments.
<form action="/process" method="post">
<label for="message">Your Message:</label><br>
<textarea id="message" name="user_message" rows="5" cols="40" placeholder="Enter your comments here..."></textarea>
<br><br>
<input type="submit" value="Send Message">
</form>
- Unlike <input>, <textarea> is not an empty tag; it has opening and closing tags. Any text between the tags becomes the default content.
- The `rows` attribute specifies the visible number of text lines.
- The `cols` attribute specifies the visible width in average character widths.
- Use CSS for more precise control over size and styling.
- It requires `name` and `id` attributes like other form controls.
- The `placeholder` attribute works similarly to text inputs.