简体   繁体   English

悬停对TR的TD的影响

[英]hover effect on the TR 's TD

I have defined the following inside my css:- 我在CSS中定义了以下内容:

 .mainTr {
       background-color:#78a22f;
       color:white;
   }
   .mainTr :hover{
       background-color: #C1D72E;
       color:#78a22f;
   }

and i have the following TR:- 我有以下TR:

 <tr class="mainTr">
                        <td><b>SPECIFICATIONS</b></td>
                        <td><b>FEATURES</b></td>
                    </tr>

but currently when i hover over a TR only on TD will got the new hover effect and for its text color while the background color will not be #C1D72E, also the other TD will keep rendering the defualt behavioure .. 但是目前,当我仅在TD上悬停在TR上时,会获得新的悬停效果,并且其文本颜色为背景颜色而不是#C1D72E,其他TD也将继续呈现默认行为。

在此处输入图片说明

I think u did not use table tag when u using tr and td tag example below: 我认为当您使用下面的tr和td标签示例时,您没有使用表标签:

html: 的HTML:

<table> 
<tr class="mainTr">
      <td><b>SPECIFICATIONS</b></td>
      <td><b>FEATURES</b></td>
</tr>
</table>

CSS: CSS:

.mainTr{
       background:#78a22f;
       color:white;
       padding:10px;
}
 .mainTr:hover{
       background-color:#C1D72E;
       color:#78a22f;
 }

jsfiddle https://jsfiddle.net/Grald/qd6c2zww/ jsfiddle https://jsfiddle.net/Grald/qd6c2zww/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM