We have a textarea per row, showing a description. But we don't want to have to keep resizing the box.
I have a script that will resize a box when you Add a product, but we want the textarea to be the height of the text within it.
I thought "height: auto" would work, but it doesn't.
Any ideas?
textarea: can you make it same height as content text?
Moderator: General Moderators
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
textarea: can you make it same height as content text?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: textarea: can you make it same height as content text?
About the only way I know of is to use Javascript. Create an invisible <div> off screen that is the same width as the textarea will be, then insert the content into that div. Then, find the height of that div and set the height of the textarea to the same.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.