Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stop div content overflowing?

Tags:

html

css

If I have a div with a specific width, and it contains continuous content, then it will overflow. Is there a way to make it break the word and move part of it to the next line? e.g:

<div style="float:left;width:200px;">thiscontentwilloverflowthedivbecuaseitdoesnthaveanyspacesinit</div>

Thanks.

like image 931
Andy Lobel Avatar asked Jan 26 '26 12:01

Andy Lobel


1 Answers

add the following css:

overflow:hidden; word-wrap:break-word

word-wrap is css3 so it won't work with every browser

like image 170
André Alçada Padez Avatar answered Jan 29 '26 03:01

André Alçada Padez



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!