rows attribute defines the number of lines of text
that are visible in the
textarea. However, how well
this actually matches up to the number of characters displayed height-wise
is debatable, as the font style for characters may vary between
browsers—especially if the style is changed by CSS. If no
rows attribute is specified (even though it’s a
required attribute), the
textarea will render
with approximately three visible lines of text. If you provide a
rows value of
textarea appears just over three times taller than the
default height, as Figure 1
textareas, the first without a
rowsattribute, the second with
rows is a required
attribute, as is
cols, so you shouldn’t
replace it with CSS styling. Instead, the CSS should
override the size defined in this attribute. Without this
attribute, your page can’t possibly validate (and besides, it’s helpful
for users who are browsing with CSS switched off).
attribute for this
textarea is set to
<form> <label for="perfectday">Describe your perfect day:</label> <textarea id="perfectday" accesskey="d" cols="40" rows="10"> </textarea> <input type="submit" value="Tell us"/> </form>
This attribute accepts a number only—it won’t accept percentages or other values.
It causes no compatibility issues, and has excellent support across all tested browsers.
There are no comments yet.