Is there a css (non-js) solution to have my 开发者_JAVA技巧box to increase height (wrap) when the current text overflows the given width?
Thanks!
No. The contents in the input
box are in no relation to the width of the box itself, and there is no CSS property to make it so. You will need to use JavaScript for this.
In short the answers no.
This would be doable with Javascript though. Why do you need a non-js answer?
Given that you want to increase text area in its height. It is possible at CSS3 supporting browsers like FF4. You can also control the direction of which it can be resized.
Another of the CSS3 solution can be using contenteditable
element, instead of textarea, which will make how you want possible without using any javascript?
I might show you some examples if this is what you want.
It cannot be achieved through CSS but you can go for a ONE-liner plugin Elastic
, you can see the demo here
and download here
精彩评论