输入类型=按钮的背景颜色: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 :)
相关文章