输入类型=按钮的背景颜色:IE 中的悬停状态

2023-11-29前端开发问题
2

本文介绍了输入类型=按钮的背景颜色: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 中的悬停状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

layui 单选框、复选框、下拉菜单不显示问题如何解决?
1. 如果是ajax嵌套了 页面, 请确保 只有最外层的页面引入了layui.css 和 layui.js ,内层页面 切记不要再次引入 2. 具体代码如下 layui.use(['form', 'upload'], function(){ var form = layui.form; form.render(); // 加入这一句});...
2024-11-09 前端开发问题
313

layui要如何改变时间日历布局大小?
问题描述 我想改变layui时间日历布局大小,这个要怎么操作呢? 解决办法 可以用css样式对时间日历进行重新布局,具体代码如下: !DOCTYPE htmlhtmlheadmeta charset="UTF-8"title/titlelink rel="stylesheet" href="../../layui/css/layui.css" /style#test-...
2024-10-24 前端开发问题
271

layui 表格的默认工具栏添加自定义按钮
首先定义table: var tableIns = table.render({ elem:'#businessUserListTable' ,url: ctx+'/business/businessUser/query' ,error:admin.error ,cellMinWidth: 80// ,width:3700 ,toolbar: '#businessUserListTable-toolbar' ,defaultToolbar: [{ title: '...
2024-06-12 前端开发问题
146

为什么backbone.js在访问模型时返回一个空数组?
Why is backbone.js returning an empty array when accessing models?(为什么backbone.js在访问模型时返回一个空数组?)...
2024-04-20 前端开发问题
10

启动backbone.js 历史记录时无法调用未定义的“开始".
Cannot call #39;start#39; of undefined when starting backbone.js history.(启动backbone.js 历史记录时无法调用未定义的“开始.)...
2024-04-20 前端开发问题
3

随每个骨干网同步请求发送令牌
Send token with every backbone sync request(随每个骨干网同步请求发送令牌)...
2024-04-20 前端开发问题
10