4

I have a div with contenteditable set to true to act as a text input. Now usually, it expands as some text reaches the end of the div, but if I resize the div, this stops happening. The browser no more does this. I tried to set the height after resizing it to auto, but it didn't help either.

Please help me on that one. Thanks.

Michael S.
  • 305
  • 4
  • 17

2 Answers2

12

If you've set the height absolute the browser will handle it absolute. So apply the following css rules to your div:

#yourdiv {
    height: auto;
    min-height: 150px;
}
noob
  • 8,982
  • 4
  • 37
  • 65
3

Here you have an example: http://html5demos.com/contenteditable look at it's source code with chrome or firebug.

It all goes around the width, height, and overflow. You should also be carefull with the word-wrap property. Check it out! :)

cesarnicola
  • 764
  • 1
  • 5
  • 14