我有以下 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/