鼠标悬停时更改按钮的 CSS
change css of button when mouse over
#buttonShareMap:disabled {
background:black;
}
如果禁用,会将我的按钮的颜色更改为黑色。
但是,如果禁用,并且用户将光标悬停在按钮上,它将变为蓝色,这是启用按钮时通常的颜色class="edit blue btn".....
我想在禁用按钮时始终保持黑色...所以是这样的:
.buttonShareMap:disabled:hover
{
background:black;
}
无法让它工作...有什么想法吗?呵��
此外,光标将变为鼠标悬停在手上...当按住禁用按钮时。我希望它保留为光标,只有在启用按钮时才更改为鼠标悬停?
您可以使用
!important
,这应该可以工作。背景可能被级联覆盖了。 最好找出位置并纠正它而不是!important
但如果您需要一个快速而肮脏的解决方案,它将起作用。 此外,您可以将光标设置为禁用时的默认光标。 CSS加在一起将是:
#buttonShareMap:disabled {
background:black !important;
cursor:default;
}
A disabled button wont be able to catch the JS events like hover, mouseover etc. If you want to change your disabled button color, you can directly do it using CSS. You can do something like:
<style>
input.button:disabled{ background: #000; color: #FFF; cursor: default;}
</style>
<input type="button" class="button" value="Button" disabled>
If the background color is not picked you can add an !important with the CSS rule.
相关文章:
- FF和Chromium中CSS样式按钮的外观差异
- 如何通过按键激活按钮应用CSS效果
- 单击时如何更改单选按钮的CSS
- 使用javascript单击同一按钮,在两种样式之间更改css值
- 在jquerymobile中设置按钮css属性的动画
- 鼠标悬停时更改按钮的 CSS
- 将 CSS 应用于禁用的输入按钮
- 将回车键映射到HTML/CSS/JS中的按钮
- JS CSS切换按钮没有'不要向上移动
- css中的按钮对齐
- CSS Html使图像显示在单选按钮的选项上(单选按钮被CSS隐藏)
- 如何使按钮CSS更改只有IF表单字段有效
- 在表单按钮css中的文本旁边添加图像
- 如何删除出现在弹出窗口上的onclick按钮-CSS&JS相关
- 滚动固定顶部按钮| CSS &jQuery
- 更新一个带有动态id的按钮css
- 从按钮列表创建可重用的按钮css/jquery
- 样式化单选按钮(CSS/jQuery)
- JQuery 验证插件会更改提交按钮 CSS
- 切换两侧按钮css