twitter-bootstrap 在可点击的表格行上添加突出显示(使用引导程序)- CSS

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19964325/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 19:11:44  来源:igfitidea点击:

Add highlight on clickable table row (using bootstrap) - CSS

csstwitter-bootstrap

提问by Chemist

I want to highlight row on mouseover (hover). I am using bootstrap and on the table I use their class table-striped, so when I write css:

我想在鼠标悬停(悬停)时突出显示行。我正在使用 bootstrap 并且在桌子上我使用他们的 class table-striped,所以当我编写 css 时:

tbody {
  tr:hover {
    background-color: #ff0;
  }
}

It only changes color on rows that are white, but not the other ones. Not sure what the best way to solve this problem is. Maybe I can overwrite table-striped highlighting somehow? How would I do that?

它只更改白色行的颜色,而不会更改其他行的颜色。不确定解决此问题的最佳方法是什么。也许我可以以某种方式覆盖表条纹突出显示?我该怎么做?

回答by Zim

Try using the 'table-hover' and override the color like this..

尝试使用“table-hover”并像这样覆盖颜色..

.table-hover>tbody>tr:hover>td, .table-hover>tbody>tr:hover>th {
  background-color: #550055;
  color:#eeeeee;
}

http://bootply.com/93988

http://bootply.com/93988