HTML Guide
The attribute rows
on a textarea
element, when present, must be a positive integer.
The <textarea>
HTML element represents a multi-line plain-text editing control, useful when you want to allow users to enter a sizeable amount of free-form text, for example a comment on a review or feedback form. Its attributes rows
and cols
allow to define the dimensions of the text area by respectively specifying the numbers of rows and columns.
Example:
<textarea name="comments" rows="5" cols="25">
It all works great!
</textarea>
Learn more:
Related W3C validator issues
The <textarea> element does not have a type attribute.
The HTML <textarea> element represents a multi-line plain-text editing control, and is useful when you want to allow users to enter a sizeable amount of free-form text, for example a comment on a review or feedback form.
Remove the empty maxlength and provide a valid non‑negative integer, or omit maxlength entirely.
The maxlength attribute limits the number of characters a user can enter. It must be a valid non-negative integer (0, 1, 2, …). An empty string, whitespace, or non-numeric value fails validation. When maxlength is omitted, the length is unlimited. When set to 0, no characters can be entered. The value applies to the textarea element itself, not its content.
Common fixes:
- Set maxlength to a concrete number like 200.
- If you don’t need a limit, remove the attribute.
- Ensure templating doesn’t output an empty attribute (e.g., maxlength="").
HTML Examples
Invalid example (reproduces the validator error)
<!DOCTYPE html>
<html lang="en">
<head>
<title>Invalid maxlength</title>
</head>
<body>
<form>
<label for="msg">Message</label>
<textarea id="msg" name="message" maxlength=""></textarea>
</form>
</body>
</html>
Fixed example (valid integer or omit attribute)
<!DOCTYPE html>
<html lang="en">
<head>
<title>Valid maxlength</title>
</head>
<body>
<form>
<label for="msg">Message (max 200 chars)</label>
<textarea id="msg" name="message" maxlength="200"></textarea>
</form>
</body>
</html>
The value street-address cannot be used for attribute autocomplete on an <input> element. As this kind of autofill is oriented for multi-line inputs (as in the expected format for addresses), consider using a <textarea> element instead, like in this example:
<textarea name="address" autocomplete="street-address"></textarea>
Invalid value “virtual” was used for the wrap attribute on a textarea.
The wrap attribute controls how the browser wraps text when submitting a form. It accepts only two keyword values:
- soft (default): Lines are not hard-wrapped on submission; the server receives unwrapped lines.
- hard: The browser inserts CRLFs at wrap boundaries on submission; you must also set cols for hard to be valid.
virtual was a non-standard value used by some legacy browsers and is not allowed by the HTML Standard or the W3C validator. Remove wrap entirely to get soft wrapping, or set it to soft/hard as needed. If you choose hard, include a sensible cols value. You can also control visual wrapping with CSS like white-space if needed.
HTML Examples
Example: Reproduces the validator error
<!doctype html>
<html lang="en">
<head>
<title>Textarea Wrap Error</title>
</head>
<body>
<form>
<label for="msg">Message</label>
<textarea id="msg" name="msg" wrap="virtual"></textarea>
</form>
</body>
</html>
Example: Valid fixes
<!doctype html>
<html lang="en">
<head>
<title>Textarea Wrap Fix</title>
</head>
<body>
<form>
<label for="msg-soft">Message (soft)</label>
<textarea id="msg-soft" name="msg" wrap="soft"></textarea>
<label for="msg-hard">Message (hard)</label>
<textarea id="msg-hard" name="msg" wrap="hard" cols="40" rows="5"></textarea>
</form>
</body>
</html>
A <textarea> tag can’t be used inside an <a> tag.