View Full Version : textarea problems in IE and Mozilla

02-03-2004, 05:05 AM
I have two problems.

1. Why did the rows attribute change from IE 5.0 to IE 6? In IE 6, rows="4" gives you 3 rows while it gave the correct amount in IE 5.0. This is a hazard when it comes to compatibility.

2. If I make a textarea in Mozilla, it's always bigger than the rows allocated. It can hold 6 rows when I tell it 4. And it also doesn't wrap.

Which one of these is standard? Is there any workarounds for this? Or is the textarea tag doomed from this point on?

02-23-2004, 09:45 PM
I've done some searching and here's all I found:
http://www.w3.org/MarkUp/1995-archive/Elements/TEXTAREA.html. (Now that's an old looking page for the W3).

I have a textarea that expects 16 numbers ranging from 1 to 8 (it's validated by a regexp). It's 4 rows and 4 columns.

In Mozilla, when you type text into a textarea that has those limitations, it will not wrap. Why is this?

But in Internet Explorer 5, cols="4" means 4 columns. But in Internet Explorer 6, cols="4" means 3 columns and a scrollbar that takes up a whole column (even if it's disabled or not used).

What is the solution? This tag is not depricated but it's support among browsers is very loose and unpredictable. The W3 doesn't have any up-to-date info on this tag let alone a set of rules the browsers should be following. Does anyone have a recommendation for this?

02-24-2004, 11:39 AM
Just a wild guess...but why not define your textarea with css plus overflow:auto. Or maybe try to increase the cols and rows until you know what Moz's wrap limitation is...:D

02-24-2004, 08:00 PM
I don't use rows or cols attributes at all. I leave them out, and define the dimensions in CSS.

Modern browsers handle that fine, and I've never had any wrapping problems in any browsers, without definining any overflow CSS or using non-standard "wrap" attribute values. It should just work.

Browsers with no CSS support will render it at a default size, which is usually quite small, but nonetheless useable - unless you're using the textarea for visual formatting, but if so you should be using a <pre> block and not <textarea>