输入类型=按钮的背景颜色:IE 中的悬停状态 [英] Background color on input type=button :hover state sticks in IE

查看:14
本文介绍了输入类型=按钮的背景颜色:IE 中的悬停状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个输入 type=button 设置了背景颜色,而在 :hover 上设置了一个不同的按钮 - 请参阅 http://jsfiddle.net/hc2Eu/3/

I have an input type=button with a background color set and a different one on :hover - see http://jsfiddle.net/hc2Eu/3/

在 IE(所有版本)中 - 当我将鼠标按下按钮时,移开按钮,然后 mouseup - 背景颜色保持在 :hover 设置中,直到您再次将鼠标悬停在它上面.

In IE (all versions) - when I mouse down on the button, move off the button, then mouseup - the background color stays in the :hover setting until you mouse over it again.

有解决办法吗?最好不要用js?(不需要IE6)

Is there some workaround for this? Preferably not with js? (IE6 not necessary)

推荐答案

<input type="button"> 可能会有修复 - 但如果有,我不会知道的.

There might be a fix to <input type="button"> - but if there is, I don't know it.

否则,一个不错的选择似乎是将其替换为精心设计的 a 元素.

Otherwise, a good option seems to be to replace it with a carefully styled a element.

示例:http://jsfiddle.net/Uka5v/

.button {
    background-color: #E3E1B8; 
    padding: 2px 4px;
    font: 13px sans-serif;
    text-decoration: none;
    border: 1px solid #000;
    border-color: #aaa #444 #444 #aaa;
    color: #000
}

优点包括 a 元素将在不同(旧)版本的 Internet Explorer 之间保持一致的样式,无需任何额外工作,我认为我的链接看起来比那个按钮更好:)

Upsides include that the a element will style consistently between different (older) versions of Internet Explorer without any extra work, and I think my link looks nicer than that button :)

这篇关于输入类型=按钮的背景颜色:IE 中的悬停状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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