日期:2014-05-18  浏览次数:20742 次

怎么控制<td>间字符的个数阿
在固定宽度的表格中,若输入的英文字符总长度超过了表格宽度,则表格就会撑大,中文则不会。
<td   title= "${list.comments} ">
<a   href= "# "   onclick= "showDetail( '${list.infoID} ', '${item} ') ">
    ${(empty   list.comments)?   "NA "   :   list.comments     }
  </a>
</td>

想固定 <td> 间的list.comments   的字符长度,太大表格就变大影响UI,而且还要保持链接

这要怎么做啊

------解决方案--------------------
<style type= "text/css ">
td {overflow:hidden; text-overflow:ellipsis;}
</style>
<table width= "100% " border= "1 " cellpadding= "2 " cellspacing= "2 " bordercolor= "#CCCCCC " style= "table-layout:fixed ">
<tr>
<td> afdsssssssssssssssssssssssssasdfasdfasdfasdfasdf </td>
<td> afdsssssssssssssssssssssssssasdfasdfasdfasdfasdf </td>
<td> afdsssssssssssssssssssssssssasdfasdfasdfasdfasdf </td>
<td> afdsssssssssssssssssssssssssasdfasdfasdfasdfasdf </td>
</tr>
</table>