View Full Version : textarea rows="2" limitation Firefox

03-06-2006, 06:35 PM
Here is the code in question.

<textarea rows="2"></textarea>

IE 6 understands the textarea should only have two rows. Firefox is forcing three rows. How can I fix this issue?

Is this a Firefox bug?

03-06-2006, 06:55 PM
You could try using CSS to define the height.

Here's an example using inline CSS.

<textarea rows="2" style="height:2em;"></textarea>

Also you could try searching Bugzilla (https://bugzilla.mozilla.org/).

03-06-2006, 07:24 PM
I agree, the best thing to do anyhow is to use a style to tell it exactly what you want. Make a class or use an inline style. Whatever you like best.

<textarea name="message" rows="2" cols="40" wrap="virtual" style="width:250px; height:25px;">Type your message here</textarea>


03-06-2006, 08:06 PM
I'm wondering if that extra line is for a potential scrollbar. Is there a way to turn the scrollbar off? I notice IE has a vertical scrollbar.

user agents should provide some means to scroll through the contents of the control when the contents extend beyond the visible area.

03-06-2006, 08:41 PM
I don't think you can turn the scrollbar off in IE. FF doesn't display a scrollbar unless it is necessary. A work-around for IE would be to "hide" the scrollbar by using a CSS class and assigning it to your textarea. The class would define all the scrollbar colors to be the same as you told the background-color of the textarea to be = hidden...sorta. ;)

.no_scroll_textarea {
background-color: #FFFFFF;
scrollbar-face-color: #FFFFFF;
scrollbar-highlight-color: #FFFFFF;
scrollbar-shadow-color: #FFFFFF;
scrollbar-3dlight-color: #FFFFFF;
scrollbar-arrow-color: #FFFFFF;
scrollbar-track-color: #FFFFFF;
scrollbar-darkshadow-color: #FFFFFF;


03-06-2006, 08:57 PM
Just use overflow:auto; the scrollbar goes away in IE when not needed.