Twitter bootstrap 去掉了表格上的悬停背景颜色 [英] Twitter bootstrap take out the hover background color on tables

查看:32
本文介绍了Twitter bootstrap 去掉了表格上的悬停背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了 45 分钟研究如何消除行悬停时的背景颜色变化.

I've spent 45min looking on how to remove the background color change on row hover.

见小提琴:http://jsfiddle.net/BJrnC/1/

以防万一我不清楚.当您使用引导程序在表格的 tbody 中悬停一行时,背景会变为灰色.问题是我真的很喜欢他们的布局,但我就是不喜欢那样.

Just in case I'm not clear. When you hover a row in the tbody of a table using bootstrap, the background goes to grey. The problem is that I really like the layout they have, but I just don't like that.

如何禁用它?

谢谢.

推荐答案

您可以在样式表中添加以下内容以覆盖该功能:

You can add the following on your stylesheet to overwrite that feature:

.table tbody tr:hover td, .table tbody tr:hover th {
    background-color: transparent;
}

演示:http://jsfiddle.net/BJrnC/2/

注意:注意到我仍然为这个答案点赞.推特引导程序现在默认执行此操作.如果您想向表格添加悬停效果,只需将 .table-hover 悬停类添加到您的表格主体,否则只需省略它,它在悬停时不应有任何效果.这仅适用于最新版本的引导程序.

Note: Noticed that I'm still getting upvoted for this answer. The twitter bootstrap now does this by default. If you want to add hover effects to a table simply add the .table-hover hover class to the body of your table, otherwise just omit it and it should not have any effects when hovered. This only applies to the latest version of the bootstrap.

这篇关于Twitter bootstrap 去掉了表格上的悬停背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆