html - 无法在 IE 中将 anchor 标记设置为 [已禁用]

标签 html css internet-explorer

我有以下 CSS 代码。 button.png 是垂直粘贴 3 个按钮状态的图像,所以我只是在 css 中移动图像。

a.button
{
    background-image: url(button.png);
    background-position: 0px 0px;
    width: 100px;                                            
    height: 30px;
    display: block;
    background-repeat: no-repeat;
    text-indent: -9999px;
}
a:hover.button
{
    background-position: -100px 0px;
}
a.button[disabled]
{
    background-position: -200px 0px;
    cursor:default;
}

我把它放在html中

<a href="#" class="button" disabled="disabled"></a>

在 Chrome 中一切正常。 IE 不显示禁用图像。

最佳答案

IE 6 无法处理属性选择器。 Source

不过,IE 7 和 8 应该能够处理 a.button[disabled=disabled]

为了完全兼容,您必须向禁用按钮添加一个类:

a.button[disabled],
a.disabled
{
...
}

<a href="#" class="button disabled" disabled="disabled"></a>

关于html - 无法在 IE 中将 anchor 标记设置为 [已禁用],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2453945/

相关文章:

javascript - 在 Summernote 中获取选定的内容

javascript - 如何计算第二个和第三个点的去向以便使用点创建一个环?

css - html 5 节元素之间的默认间距?

html - 调整窗口大小时如何阻止div相互移动?

html - 页脚标记违背分配的行为

c# - 在 IE8 中,chrome 下拉列表的宽度与下拉框的宽度相同,而在 IE9 中,下拉列表的宽度不同。如何修复?

internet-explorer - IE7 和 inline-block PLUS 使 li 扩展到子元素的大小

html - 带十进制数的列表

javascript - 创建表映射的问题

Javascript 在谷歌浏览器中工作但在 IE 中被阻止