twitter-bootstrap Bootstrap 表格行悬停
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20413674/
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
Bootstrap table row hover
提问by user6827
How do I make the background change of a table row in Bootstrap 3on hover. The table class I am using right now is table table-striped. I tried to add a extra class to the <tr>tags within the table and made the css like this .table-row:hover{background:black;}. Now only the non-striped rows are working. Isn't there a class in bootstrap that will allow me to easily implement this? Or should I use JQueryto fix this? I really cannot figure this one out by myself.
如何Bootstrap 3在悬停时更改表格行的背景。我现在使用的表类是table table-striped. 我尝试向<tr>表中的标签添加一个额外的类,并制作了这样的 css .table-row:hover{background:black;}。现在只有非条纹行在工作。引导程序中没有一个类可以让我轻松实现它吗?或者我应该用它JQuery来解决这个问题?我真的无法自己弄清楚这一点。
回答by jraede
You need to add the table-hoverclass to the <table/>element. Like this:
您需要将table-hover类添加到<table/>元素中。像这样:
<table class="table table-striped table-hover">
<tbody>
<tr>
<td>Col 1</td>
<td>Col 2 </td>
</tr>
</tbody>
</table>
Source: Documentation
来源:文档

