1

hi how can i make the text inside div coming to the next line if the text covers the width of contenteditable="true"

Just like gmail chat when some one writes anything inside div then it automatically moves to next line

I am talking about the contentEditable="true" div means the div in which we can edit or write text.

Orbling
  • 20,413
  • 3
  • 53
  • 64
pravat231
  • 782
  • 1
  • 11
  • 26
  • A div with a fixed width should do this already. – robbrit Nov 18 '10 at 19:53
  • plz read the question again i edited it. – pravat231 Nov 18 '10 at 19:58
  • contentEditable is HTML5 only is it not, should have an 'html5' tag. I believe it does wrap properly if the width is restricted either by a parent or by a width declartion on itself. – Orbling Nov 18 '10 at 20:10
  • possible duplicate of [

    when text exceeds width, continue in new line](http://stackoverflow.com/questions/13790170/p-when-text-exceeds-width-continue-in-new-line)

    – bummi Jul 06 '15 at 07:23

2 Answers2

6
.break-word { 
word-wrap: break-word;
}
Gregg B
  • 13,139
  • 6
  • 34
  • 50
-1

Sometimes it is not enough using "word-wrap : break-word".

.break-word { 
  word-wrap: break-word;
  display:flex;
}
Andrew
  • 4,953
  • 15
  • 40
  • 58
IDF
  • 93
  • 1
  • 9