2011-05-04 142 views
6

我有一个看起来像讲话泡泡的div。主要的div是泡沫和:之前是箭头。我想要做的是当你在CSS中翻转:hover DIV时,它也会改变:before更改:在何时:将鼠标悬停在主DIV上?

这里是我的代码:

.sidebar_image_box_newsfeed_user_info_comments { color: #ffffff; background-color: #2f2f2e; text-decoration: none; -webkit-transition-property: background-color, color, text-decoration; -webkit-transition-duration: 0.5s, 0.5s, 0.5s; } 

.sidebar_image_box_newsfeed_user_info_comments:hover { background-color: #3b3b3b; color: #f3f3f3; text-decoration: underline; } 

.sidebar_image_box_newsfeed_user_info_comments:before { content:""; position:absolute; bottom:-6px; right:0; border-width:0 0 6px 6px; border-style:solid; border-color:transparent #2f2f2e; text-decoration: none; -webkit-transition-property: background-color, color, text-decoration; -webkit-transition-duration: 0.5s, 0.5s, 0.5s; } 

回答

20
.sidebar_image_box_newsfeed_user_info_comments:hover:before { 
    content: "I am new"; 
} 

jsFiddle

+1

扩展alex的答案,你可以用url(图片)替换“我是新的”图像 – robx 2011-05-04 02:58:29

+0

不知道这个..很感谢 – 2015-01-23 14:21:15

相关问题