I threw this together haphazardly for IE 6. I didn't test it on other
browsers, but you could use it as a starting point if you don't mind
using javascript.
The script.
<script type="text/javascript">
//this is the number I got when you only have one line in the
textArea
var height = 20;
function getHeight(){
var txtArea = document.getElementById("textArea");
//debugging purposes only
document.getElementById("txt").value =
txtArea.scrollHeight;
//if the scrollHeight is bigger than what we started with,
then add to the size of the box
if (txtArea.scrollHeight > height) {
txtArea.rows=txtArea.rows + 1;
height = txtArea.scrollHeight;
}
}
</script>
And here are the form elements. The textbox was only for debugging
purposes.
<input type="text" id="txt" />
<textarea id="textArea" rows="2" cols="45"
onkeydown="getHeight();"></textarea>
This assumes that you're starting with an empty textarea, so you'll
have to add to it a bit if the textArea is full. Hope it helped!