开发者

asp.net creating a table with stringbuilder, text in <td> does not wrap or break lines, runs straight off page

开发者 https://www.devze.com 2023-01-10 04:17 出处:网络
I have a table with width of 250 px, I am creating this table using a stringbuilder, but when I add long strings to table data, the data renders as one long line, it does not stay in table.

I have a table with width of 250 px, I am creating this table using a stringbuilder, but when I add long strings to table data, the data renders as one long line, it does not stay in table.

When I use firebug I see that the table is 250 px, but data does not wrap within it.

Help pls! thanks!

EDIT: was using whitespace:nowrap; from another CSS which was messing it all up开发者_StackOverflow社区. thx for help


You can prevent a table from expanding for long strings by giving it the style table-layout: fixed.


Couple of things that you may try:

  1. Inject a style into the td that is behaving bad: style="word-wrap:break-word;"
  2. Check out the following to see if it helps: Word-wrap in an HTML table

Hope it helps!

0

精彩评论

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