将行样式应用于行悬停时的第一个表格单元格

Jon*_*Jon 2 css hover

我有一个有两个单元格的表格行.我怎样才能这样做,当我悬停行时,只有第一个表格单元格的背景会改变颜色?

#formTable tr:hover {
   background:red; // only want the first cell to change...
                   // ...this will do the whole row
}
Run Code Online (Sandbox Code Playgroud)

Kev*_*her 13

这应该工作:

#formTable tr:hover td:first-child {
   background:red;
}
Run Code Online (Sandbox Code Playgroud)

:第一个孩子:https://developer.mozilla.org/en-US/docs/CSS/:first-child