1

Following code renders a textarea which should have 3 visible rows:

<textarea id="txtInput" rows="3" cols="20" style="overflow:auto"></textarea>

However, in Firefox (version 20.0.1), 4 rows are shown instead of 3.

See also http://jsfiddle.net/KxXsS/

How can I fix this?

Mr_Green
  • 40,727
  • 45
  • 159
  • 271
Fortega
  • 19,463
  • 14
  • 75
  • 113

2 Answers2

1

Firefox adds an extra lines after the textfields. You can fix this with CSS :

@-moz-document url-prefix() {
    textarea {
        height: 4em;
    }
}

The @-moz...is for mozilla specific rule, the url-prefix rule applies the rule to any page whose URL starts with it.

Xavier
  • 3,919
  • 3
  • 27
  • 55
1

Here is the Solution

textarea {
    height: 4em;
}
<textarea id="txtInput" rows="3" cols="20" style="overflow:auto"></textarea>

Hope this helps.

Ravi Shankar Bharti
  • 8,922
  • 5
  • 28
  • 52
Nitesh
  • 15,425
  • 4
  • 48
  • 60