Simple css :before:hover not working? CSSlint no errors?
http://jsfiddle.net/nicktheandroid/k93ZK/2/
This should be really simple, I just don't understand why it's not working. When hovering over the :before
it should change it's opacity to 1, but it doesn't. Why?
p {
padding-top:15px;
position:relative;
}
p:before {
display:block;
width:55px;
height:55px;
content: 'hello';
background:#fff;
padding:5px 10px;
position:absolute;
right:0;
opacity:.5;
-webkit-transition: all 0.3s ease-in-out;
}
p:before:hover {
opacity:1;
bakcground:#000开发者_如何转开发;
}
EDIT: I'm using Chrome.
Instead of p:before:hover
, you need p:hover:before
.
See: http://jsfiddle.net/k93ZK/3/
If you want to let it work in Internet Explorer, just add the following code in your css:
p:hover{}
That's all.
Working example for Internet Explorer (10):
http://jsfiddle.net/k93ZK/63/
精彩评论