CSS:活动伪类 - 在IE中的目标子元素 [英] CSS :active pseudo class - target child elements in IE

查看:163
本文介绍了CSS:活动伪类 - 在IE中的目标子元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个具有悬停和点击效果的幻想按钮。
该按钮看起来像:

I'm making a fancy button that has hover and click effects. The button looks something like:

<a class="redB">
 <span class="a">&nbsp;</span>
 <span class="b">Email Us</span>
 <span class="c">&nbsp;</span>
</a>

我的问题是试图访问我的css中的三个span元素,如下:

My problem is in trying to access the three span elements in my css like this:

.redB:active span.a{background-position:0 -432px}
.redB:active span.b{background-position:0 -504px}
.redB:active span.c{background-position:0 -576px}

这在FF和Chrome中可以正常工作,但在Internet Explorer中却不行:(

This works fine in FF and Chrome, but not in Internet Explorer :(

我也使用css来悬停

.redB:hover span.a{background-position:0 -216px}
.redB:hover span.b{background-position:0 -288px}
.redB:hover span.c{background-position:0 -360px}


$ b b

这在FF,Chrome和IE中工作得很好。

And that works great in FF, Chrome and IE

有没有办法得到:active类像IE中的子元素一样工作?

Is there a way to get the :active class working like for child elements in IE?

推荐答案

还有一点,

子元素的类,因为它的行为好像子元素在链接之上,但是如果链接在其边缘被点击,它将工作。

IE was not doing the :active class for child elements because it was behaving as if the child elements were on top of the link, it would work, however if the link was clicked on its very edges.

在将来,我将尝试有更简单的按钮:active将工作的链接本身,只是不是在链接内的子元素,IE将其视为几乎单独,而不是链接本身的一部分,至少它是为:活动类。

In the future, I'll try to have simpler buttons as :active will work for the link itself, just not for child-elements within the link that IE treats as almost separate rather than part of the link itself, At least it does for the :active class.

这篇关于CSS:活动伪类 - 在IE中的目标子元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆