1. 程式人生 > >CSS,bootstrap表格控制當td內容過長時用省略號表示,以及在不使用bootstrap時過長也用省略號表示

CSS,bootstrap表格控制當td內容過長時用省略號表示,以及在不使用bootstrap時過長也用省略號表示

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <style type="text/css"> .mytable { table-layout: fixed; width: 98% border:0px; margin: 0px; } .mytable tr td { text-overflow: ellipsis; /*
for IE */ -moz-text-overflow: ellipsis; /* for Firefox,mozilla */ overflow: hidden; white-space: nowrap; border: 1px solid; text-align: left } </style> </head> <body> <table width="500px" class="mytable"> <tr> <td width="
20%">再別康橋</td> <td width="80%"> 輕輕我走了,正如我輕輕地來,我揮一揮衣袖,不帶走一片雲彩 </td> </tr> </table> </body> </html>