CSS-悬停时更改按钮背景颜色 [英] CSS - Change button background color on hover

查看:66
本文介绍了CSS-悬停时更改按钮背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在悬停时更改按钮背景颜色.

I need change button background color on hover.

我在jsfiddle上的CSS: CSS

My CSS on jsfiddle: CSS

我的HTML:

<input type='button' class='btn btn-default btn-success btn-lg' value='test'/>

演示

推荐答案

您可以通过以下方式实现它.如果将此类添加到CSS底部,则此解决方案将起作用.

You can achieve it in the following way. This solution will work if you add this class at the bottom of your CSS.

.btn:hover
{
background-image:none;
background-color:#ff00ff;
}

如果将此类保留在其他样式的顶部,则需要使用 important 关键字克服以下其他样式.

If you keep this class in top of the other styles, you need to use important keyword to overcome with other styles like below.

.btn:hover
{
background-image:none !important;
background-color:#ff00ff !important;
}

演示

这篇关于CSS-悬停时更改按钮背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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