我用的是Asp.Net和C#做的文章显示页面,页面显示文章部分结构是这样的:
<div>
<table>
  <tr><td>文章内容</td></tr>
</table>
</div>我起发表好几篇文章时都能正常显示,但当我发表如下面这篇文章时,表格就被撑开了:henry  david  thoreau/享利.大卫.梭罗   however  mean  your  life  is,meet  it  and  live  it  ;do  not  shun  it  and  call  it  hard  names.it  is  not  so  bad  as  you  are.it  looks  poorest  when  you  are  richest.the  fault-finder  will  find  faults  in  paradise.love  your  life,poor  as  it  is.you  may  perhaps  have  some  pleasant,thrilling,glorious  hourss,even  in  a  poor-house.the  setting  sun  is  reflected  from  the  windows  of  the  alms-house  as  brightly  as  from  the  rich  man'  's  abode;the  snow  melts  before  its  door  as  early  in  the  spring.i  do  not  see  but  a  quiet  mind  may  live  as  contentedly  there,and  have  as  cheering  thoughts,as  in  a  palace.the  town'  's  poor  seem  to  me  often  to  live  the  most  independent  lives  of  any.may  be  they  are  simply  great  enough  to  receive  without  misgiving.most  think  that  they  are  above  being  supported  by  the  town;but  it  often  happens  that  they  are  not  above  supporting  themselves  by  dishonest  means.which  should  be  more  disreputable.cultivate  poverty  like  a  garden  herb,like  sage.do  not  trouble  yourself  much  to  get  new  things,whether  clothes  or  friends,turn  the  old,return  to  them.things  do  not  change;we  change.sell  your  clothes  and  keep  your  thoughts.   不论你的生活如何卑贱,你要面对它生活,不要躲避它,更别用恶言咒骂它。它不像你那样坏。你最富有的时候,倒是看似最穷。爱找缺点的人就是到天堂里也能找到缺点。你要爱你的生活,尽管它贫穷。甚至在一个济贫院里,你也还有愉快、高兴、光荣的时候。夕阳反射在济贫院的窗上,像身在富户人家窗上一样光亮;在那门前,积雪同在早春融化。我只看到,一个从容的人,在哪里也像在皇宫中一样,生活得心满意足而富有愉快的思想。城镇中的穷人,我看,倒往往是过着最独立不羁的生活。也许因为他们很伟大,所以受之无愧。大多数人以为他们是超然的,不靠城镇来支援他们;可是事实上他们是往往利用了不正当的手段来对付生活,他们是毫不超脱的,毋宁是不体面的。视贫穷如园中之花而像圣人一样耕植它吧!不要找新的花样,无论是新的朋友或新的衣服,来麻烦你自己。找旧的,回到那里去。万物不变,是我们在变。你的衣服可以卖掉,但要保留你的思想。以上这篇文章在页面中没有自动换行,一直向右撑开了表格,请问这是怎么回事?

解决方案 »

  1.   

    我都是这样弄得:你把把这文章先复制到文本记事本上,然后再复制到你要发布的地方。因为如果是复制的东西,里面有可能是带有html标记的编排格式。
      

  2.   

    我复制了LZ的代码在HTML中,显示正常,100%显示,没有撑开
      

  3.   

      楼主问题我遇到过,不是表格的问题而是空格的问题!
    你把编辑器切换到html代码视图状态,看看里边的空格标记,把那些标签去掉就可以了。一般写文章的时候是用回车换行的,而有的人用很多空格去换行这样就造成了表格的撑开了!
       要是还不行的话楼主肯定是遇到鬼了!呵呵
      

  4.   


    我查看数据库时里的原文,果然有很多&nbsp(空格符号),如果不一个个把标签去掉那怎么样才能解决呢?
      

  5.   

    那你就保存的时候加一个.trim()函数去过滤掉所有的空格就可以了,但是有的地方,像开始空两格,还是需要空格的。所以我认为还是认为控制的好。发表文章的时候注意一下就可以了。
      

  6.   

    不知道CSDN这里是怎么做的,在这里显示正常:
    henry  david  thoreau/享利.大卫.梭罗   however  mean  your  life  is,meet  it  and  live  it  ;do  not  shun  it  and  call  it  hard  names.it  is  not  so  bad  as  you  are.it  looks  poorest  when  you  are  richest.the  fault-finder  will  find  faults  in  paradise.love  your  life,poor  as  it  is.you  may  perhaps  have  some  pleasant,thrilling,glorious  hourss,even  in  a  poor-house.the  setting  sun  is  reflected  from  the  windows  of  the  alms-house  as  brightly  as  from  the  rich  man'  's  abode;the  snow  melts  before  its  door  as  early  in  the  spring.i  do  not  see  but  a  quiet  mind  may  live  as  contentedly  there,and  have  as  cheering  thoughts,as  in  a  palace.the  town'  's  poor  seem  to  me  often  to  live  the  most  independent  lives  of  any.may  be  they  are  simply  great  enough  to  receive  without  misgiving.most  think  that  they  are  above  being  supported  by  the  town;but  it  often  happens  that  they  are  not  above  supporting  themselves  by  dishonest  means.which  should  be  more  disreputable.cultivate  poverty  like  a  garden  herb,like  sage.do  not  trouble  yourself  much  to  get  new  things,whether  clothes  or  friends,turn  the  old,return  to  them.things  do  not  change;we  change.sell  your  clothes  and  keep  your  thoughts.   不论你的生活如何卑贱,你要面对它生活,不要躲避它,更别用恶言咒骂它。它不像你那样坏。你最富有的时候,倒是看似最穷。爱找缺点的人就是到天堂里也能找到缺点。你要爱你的生活,尽管它贫穷。甚至在一个济贫院里,你也还有愉快、高兴、光荣的时候。夕阳反射在济贫院的窗上,像身在富户人家窗上一样光亮;在那门前,积雪同在早春融化。我只看到,一个从容的人,在哪里也像在皇宫中一样,生活得心满意足而富有愉快的思想。城镇中的穷人,我看,倒往往是过着最独立不羁的生活。也许因为他们很伟大,所以受之无愧。大多数人以为他们是超然的,不靠城镇来支援他们;可是事实上他们是往往利用了不正当的手段来对付生活,他们是毫不超脱的,毋宁是不体面的。视贫穷如园中之花而像圣人一样耕植它吧!不要找新的花样,无论是新的朋友或新的衣服,来麻烦你自己。找旧的,回到那里去。万物不变,是我们在变。你的衣服可以卖掉,但要保留你的思想。
      

  7.   

    dhdhdh                                                                                                                                                                                                                                                                                                                                                                                                                     ff
      

  8.   

    gtgg                                                                                                                                                                                                                                                                                                                                                hj                                                                                                                                                                                       jnjn                                                                                                                                                     
      

  9.   

    楼主:我试验了我的一个文章发布,一般的是没有问题的,但是如果你恶意的去加很长的空格的话也是会撑大的(前提是我们已经在css里设置了自动换行的防止表格撑大的代码了)。不知道csdn里边是怎么弄的!
      

  10.   

     <table width="100%" border="0" cellspacing="5" style="table-layout: fixed; word-break: break-all;word-wrap: break-word">