【问题标题】:a:hover background image swap not working in IE6a:hover 背景图像交换在 IE6 中不起作用
【发布时间】:2010-12-08 07:12:50
【问题描述】:

a.dismiss-cross { 背景:透明 url(/images/cross-grey.png) 无重复滚动 0 0; 浮动:对; 边框:无; 宽度:19px; 高度:19px; 显示:块; }

a.dismiss-cross:hover {
    background-position: 0 -19px;
}

并用

实现
 <a class='dismiss-cross' href='#'></a>

你瞧,它在 IE 中不起作用,而在其他所有浏览器中都很好。

有什么想法吗?

谢谢。

【问题讨论】:

  • 不能在任何版本的 IE 中工作?还是只有 IE6?
  • 您是否尝试过使用  在 a 元素中,像这样  ?
  • 您发布的代码确实适用于 IE6。除非你的形象有问题,否则一定有其他因素影响它。有链接吗?

标签: css internet-explorer-6


【解决方案1】:

我不太确定,但据我所知,您必须明确声明 :link:visited 伪类:

a.dismiss-cross:link,
a.dismiss-cross:visited {
    background: transparent url(/images/cross-grey.png) no-repeat scroll 0 0;
    float: right;
    border: none;
    width: 19px;
    height: 19px;
    display: block;
}

顺便说一句,如果您使用浮动,则没有理由分配块显示。浮动意味着块显示。但是... IE6 有一个带有边距的浮动元素的错误。它使利润加倍。修复很简单。你设置display: inline;。这被所有其他浏览器忽略,但修复了 IE6。

【讨论】:

    猜你喜欢
    • 2013-10-16
    • 1970-01-01
    • 1970-01-01
    • 2017-02-14
    • 1970-01-01
    • 2015-07-25
    • 2023-03-03
    • 1970-01-01
    相关资源
    最近更新 更多