2012-12-07 85 views
1

我有一個包含兩個單元格的表格行。我如何做到這一點,當我盤旋行,只有第一個表格單元格的背景改變顏色?將CSS樣式應用於行懸浮的第一個表格單元格

#formTable tr:hover { 
    background:red; // only want the first cell to change... 
        // ...this will do the whole row 
} 
+1

您應該將解決方案作爲答案發布,然後接受它。 –

回答

1

這隻會改變第一行的第一個單元格:

#formTable tr:first-child:hover td:first-child{ 
    background-color: red; 
} 

這將更改任何行的第一個單元格:

​​
相關問題