/*table-layout:fixed 會使表格均等分*/ #TreeView1 table { width:290px; table-layout: fixed; } #TreeView1 td:first-child { width:8%; } /*+選擇下一個兄弟節點 注意+前后都有空格*/ #TreeView1 td:first-child + td { width:6%; } /*[attribute]含有某個屬性的元素*/ #TreeView1 td[class] { width:80%; text-align:left; } /*下面的才是重點*/ #TreeView1 td.node { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table-layout:fixed會使表格均等分,不過不用緊張,可以使用選擇器來調每一列的高度
http://www.w3school.com.cn/cssref/css_selectors.asp
特別對於IE8盡可能使用css2的選擇器去控制