开发者

HTML/CSS div line break

开发者 https://www.devze.com 2023-02-28 08:53 出处:网络
I\'m creating a page where the users can post comments, but I have some problems with the div which contains th开发者_JAVA技巧e message posted. If it\'s too long and without line breaks, it appears a

I'm creating a page where the users can post comments, but I have some problems with the div which contains th开发者_JAVA技巧e message posted. If it's too long and without line breaks, it appears a horizontal scrollbar. I would like to make the text automatically go in the following line like the comments posted in this site.

Have you got some ideas for making this happen?

I use chrome as browser and asp.net is the server language.

I create the div with:

Response.Write("<tr><td><div class=""target-div"">" & reader("commento").Replace(vbCrLf,"br/>") & "</div></td></tr>")


I think it's

.target-div {
    white-space:pre-wrap;
}

pre-wrap both saves user formatting (i.e., preserves multiple white-spaces) and wrap when necessary

0

精彩评论

暂无评论...
验证码 换一张
取 消