简体   繁体   中英

Line break while retrieving data from database

I have a form that contains a textarea. And the contents stored in a database. And there is a page (using php echo ) to display the content. If somebody typed the content without space, the layout is going wrong.

For example:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

I need anything that automatically inserts a line break.

Look at built in function wordwrap

Wraps a string to a given number of characters using a string break character.

One idea is to set overflow: scroll in css for that div.

you can use word-wrap: break-word; CSS property when displaying it, but it is a CSS3 property ie it works on Google Chrome, FireFox4, Opera 10, IE9 ONLY.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM