可以在:first-child:after上使用:hover吗? [英] Is it possible to use :hover on :first-child:after?
本文介绍了可以在:first-child:after上使用:hover吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HTML
<div>
<div></div>
</div>
CSS
div > :first-child:after {
background-color: orange;
color: #fff;
font-family: sans-serif;
font-size: 50px;
line-height: 50px;
text-align: center;
vertical-align: middle;
-webkit-font-smoothing: antialiased;
content: "hello world";
display: block;
font-size: 50px;
height: 160px;
line-height: 160px;
margin-top: 14px;
font-weight: normal;
}
div > :first-child:after:hover {
background-color: #44b800;
}
小提琴
基本上,我想做的就是更改悬停时的背景颜色,但这似乎不起作用.
Basically, all I want to do is change the background-color on hover but it doesn't seem to work.
推荐答案
您可以这样做:
div:first-child:hover::after {
background-color: #44b800;
}
这篇关于可以在:first-child:after上使用:hover吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文