2012-03-22 156 views
6

以下网站上的工作元素上悬停:http://cetcolor.comIE不尊重:

桅顶的图形与“阅读它”按钮与悬停定位链接,当在显示器推出的橙色按钮图形,是一个可点击的链接。

但是,在IE浏览器中它不起作用。

这里是受影响的HTML:

<div id="header"> 
    <a href="/" title="CET Color"><img src="images/logo.gif" width="147" height="86" alt="CET Color" class="logo"></a> 
    <span class="strapline">Affordable Large-format UV Printing Solutions</span> 
    <a href="/pressroom_article8" class="read_about_it"></a>  
</div> 

这里是引用CSS:

#header .read_about_it { 
    position: absolute; 
    top: 239px; 
    left: 803px; 
    z-index: 100; 
    width: 114px; 
    height: 17px; 
} 
#header .read_about_it:hover { 
    background-image: url(/images/masthead_index_read_about_i.jpg); 
    background-repeat: no-repeat; 
    cursor: pointer; 
    z-index: 101; 
} 

有没有人有,为什么悬停没有在IE浏览器中工作的任何想法?

+1

一个原因可能是您有一个空的链接。尝试在其中插入一些文本并执行“text-indent:-9999px”将其移出。 – easwee 2012-03-22 16:18:19

+0

我认为你是对的,这个问题处理的链接是空的。当我将内容添加到链接时,它会起作用。当我在上面的第一个声明中添加文本缩进时,它停止工作。不知道该怎么办... – Yazmin 2012-03-22 19:34:21

回答

9

我有一个适合您的解决方案。只需为您的read_about_it类定义背景颜色或背景图像即可。

你的CSS代码/或IE中存在明显的逻辑错误 - 取决于观点。你的A标签是空的 - 我不是说文字,而是背景(你改变悬停状态的背景)。我们都知道IE生活在它自己的世界中,并以不同的方式处理HTML,因为它使用古代的Trident引擎。但是,如果元素为空(没有背景),IE将不会更改悬停状态的背景,因为IE假定不需要更改或创建尚不存在的内容。
干杯!

+1

我能够通过在背景中添加一个透明的gif来获得这个工作。非常感谢。 – Yazmin 2012-03-22 20:03:14

+0

不客气!使用transperant gif是个不错的主意。 – 2012-03-23 10:26:48

4

添加“display:block;”到它,它应该为你工作。

#header .read_about_it { 
    display: block; 
    position: absolute; 
    top: 239px; 
    left: 803px; 
    z-index: 100; 
    width: 114px; 
    height: 17px; 
} 
+0

我试过了,但没有奏效。这种模式是否特定 - 标准,松散? – Yazmin 2012-03-22 19:35:04

+0

“display:inline-block;”也工作 - 谢谢。 – buffjape 2014-08-03 13:59:49

3

我已经有同样的问题,我已经用解决这个问题:

#header .read_about_it { 
    display: block; 
    background: rgba(255, 255, 255, 0); 
    position: absolute; 
    top: 239px; 
    left: 803px; 
    z-index: 100; 
    width: 114px; 
    height: 17px; 
} 

的 “背景技术:RGBA(255,255,255,0)” 是解决这个问题的一个关键字。但是你想IE-7或更老,你可以把background-image:url(URL_TO_TRANSPARENT_IMAGE)。