http://www.cnblogs.com/zjxbetter/articles/1323449.html
eg:
<table> <tr> <td width="200" style="word-break:break-all;">asdfsasdfasd擴大發射點法打發深刻發射點激發的發覺山地飛機啊飛機萊塞解放龍卷風啊fasasdfsasdfasdfasasdfsasdfasdfasasdfsasdfasdfasasdfsasdfasdfasasdfsasdfasdfasasdfsasdfasdfas</td> </tr> </table>
html中td自動換行
head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>無標題文檔</title> <style type="text/css"> table { border-collapse: collapse; border: 1px black solid; } tr td { border: 1px black solid; height: 20px; text-align:center; } </style> </head> <body> <table width="500" rules="all" style="table-layout:fixed"> <tr> <td width="200px" rowspan="2" style="word-wrap : break-word "> 內容內容 內容內容 內容內容 內容內容 內容內容 </td> <td> </td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table> </body> </html>
效果圖

第一種方法是直接引用樣式: <style type="text/css"> .label{word-wrap:break-word;word-break:keep-all;overflow:hidden;} </style> <asp:Label ID="Label3" runat="server" Width="350px" Text='<%# Bind("y_question") %>' CssClass="label"></asp:Label> 復制代碼 第二種方法:查看頁面源碼發現,解析后的label標簽為<span> 所以在頁面添加樣式: <style type="text/css"> span{word-break:break-all;} </style> <asp:Label ID="Label3" runat="server" Width="350px" Text='<%# Bind("y_question") %>' ></asp:Label>
