当前位置: 代码迷 >> J2EE >> td中内容为特殊字符时,该如何换行
  详细解决方案

td中内容为特殊字符时,该如何换行

热度:42   发布时间:2016-04-22 00:56:28.0
td中内容为特殊字符时,该怎么换行?
<div style="word-break:break-all; width:100px;">${x[0]}</div> 这是我控制的,${x[0]}是我取的值为:???????????????????????????????????????????????????????????????????????????????????????????
这么的问号,可是页面上是不会换行的,该怎么控制下呢,中文和英文是能控制的。

当值为:换???????????????????????????????????????????????????????????????????????????????????????????行

这个的时候,文字换行了,问号还是没有换行


------解决方案--------------------
style.wordBreak = break-all
String that specifies or receives one of the following values.normal Default. Allows line breaking within words. 
break-all Behaves the same as normal for Asian text, yet allows the line to break arbitrarily for non-Asian text. This value is suited to Asian text that contains some excerpts of non-Asian text. 
keep-all Does not allow word breaking for Chinese, Japanese, and Korean. Functions the same way as normal for all non-Asian languages. This value is optimized for text that includes small amounts of Chinese, Japanese, or Korean. 


如果不行试试下面两个属性,肯定有一个能够搞定的
style.wordWrap 
String that specifies or receives one of the following values.normal Default. Content exceeds the boundaries of its container. 
break-word Content wraps to next line, and a word-break occurs when necessary. 




object.wrap 
String that specifies or receives one of the following values.soft Default. Text is displayed with wordwrapping and submitted without carriage returns and line feeds. 
hard Text is displayed with wordwrapping and submitted with soft returns and line feeds. 
off Wordwrapping is disabled. The lines appear exactly as the user types them. 

------解决方案--------------------
<table>
<tr>
<td style="width:150px;border:1px solid red;word-wrap: break-word;">???????????????????????????????????????????????????????????????????????????????????????????</td>
</tr>
</table>

之前发的有点不对,颜色没显示出来,看这条
  相关解决方案