javascript - automatically move to text next line if width of div is reach -


i want text move next line if div width reach using echo. inside div id="chat"

echo '<div style="width: auto; margin-left: 400px; margin-bottom: 5px; margin-top: 10px; padding-left:8px; padding-bottom: 10px; padding-top: 10px; padding-left: 15px; text-align:left; font-size: 0.8em; color:#015e7d;">' . '<div style="font-weight:bold;">' . "you" . "</div>message: " . $messages->msg . "<br>" . '<div style="font-size: 0.6em;">' . "send : " . $messages->dt . "</div>" . "</div>"; 

error

@squalelis suggesstion output error2

as per assumption want text come in next line when touches width of div. have use "word-wrap:break-word"

html

<div class="test">aaaa sdfjdshfjsd djhsdjs aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div> 

css

.test{width:200px;border:1px solid blue;word-wrap:break-word;} 

here live example https://jsfiddle.net/rit_design/0l5wb62r/


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -