tags:

views:

328

answers:

2

I want a textarea with no scrollbars. This is done by setting overflow to hidden. However, in Firefox, if I add a new line to the bottom of the textarea, that new line is not visible - the textarea fails to scroll down to the new line. How can I get Firefox to follow the IE/Opera behaviour, whereby if a new line is added, the textarea automatically scrolls down so that it can be seen, whether or not scrollbars are displayed?

+1  A: 

The point of overflow:hidden is to hide the scrollbars and the extra content. If you add a line outside of the limits of the textarea, it is not supposed to display.

You might be able to bypass that with some javascript. My call would be to rethink your UI, but I don't have all the elements, so maybe I'm wrong about that.

marcgg
So are you saying that the FF implementation is correct, and IE and Opera are wrong?
darasd
I'm not sure. I'd say that the specs are blurry leaving room for interpretation :)
marcgg
A: 

Are you programmatically adding the new line of text, or is the user typing it?

Either way, you can scroll the textarea to the bottom with a bit of javascript:

textarea.scrollTop = textarea.scrollHeight;

scrollHeight is the total height of the content, including the hidden bits. scrollTop is the offset of the visible area from the top of the content.

Tim Davis