当前位置: 动力学知识库 > 问答 > 编程问答 >

css - using both :after and :hover

问题描述:

Is it possible to only display the :after pseudo using :hover? For example using alternative elements.

#parent{}

#child{display:none;}

#parent:hover >#child{display:block;}

As far as I've got with the same method:

#parent{}

#parent:after{content:'hi';display:none;}

#parent:hover #parent:after{display:block;}

Is it possible at all? Or am I fooling myself?

网友答案:

You can combine the two:

#parent:hover:after {
    content:'hi';
}

JSFiddle.

网友答案:

Yes. Not sure why you didn't try it yourself but it's possible:

#parent:hover:after{content:'hi';}

http://jsfiddle.net/uz3w4/

网友答案:

Yes of course you can :

Demo

<a href="#">Demo</a>

a:hover:after {
    content: 'blah';
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: