2012-11-13 2 views
3
<div id="box"></div>​ 

#box{ 
height:40px; 
width:100px; 
background:red; 
} 

#box:hover{background:blue;} 

#box:after{ 
content: ""; 
height: 10px; 
position: absolute; 
width: 0; 
    margin-top:50px; 
background:red; 
border: 10px solid transparent; 
border-top-color: #04ADE5; 
} 
​ 

Exemple http://jsfiddle.net/zfQvD/4/vol stationnaire CSS pour avant et après l'élément

J'utilise après créé une flèche, mais quand je passe la souris sur la boîte, l'arrière-plan de la flèche ne change pas? comment changer l'arrière-plan pour la flèche, quand on est dans la boîte? grâce

Répondre

4

La flèche est faite à partir de la frontière du: après élément psuedo, afin de changer la couleur qui utilisent

#box:hover:after{border-top-color: blue;} 

http://jsfiddle.net/mowglisanu/zfQvD/9/

+0

merci pour cela, sommes-nous capables d'utiliser '-webkit-transition: all-on-out-out; -moz-transition: all-1-out-out-out; -o-transition: all-1-out-out-out; transition: tous les 1s facilité-out-out; 'pour APRÈS? ne semble pas? http://jsfiddle.net/zfQvD/13/ merci encore – olo

2

élémentaire!

#box:hover:after{ 
    border-top-color: blue; 
}