Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 是否可以使用:悬停在:第一个孩子:之后?_Css_Pseudo Class - Fatal编程技术网

Css 是否可以使用:悬停在:第一个孩子:之后?

Css 是否可以使用:悬停在:第一个孩子:之后?,css,pseudo-class,Css,Pseudo Class,HTML <div> <div></div> </div> 小提琴 基本上,我只想更改悬停时的背景色,但它似乎不起作用。您可以这样做: div:first-child:hover::after { background-color: #44b800; } 您不能:将悬停在伪类上:after和:before不能那样工作。谢谢,我原以为是这样,但在搜索答案时找不到任何东西。 div:first-child:hover::after

HTML

<div>
    <div></div>
</div>
小提琴


基本上,我只想更改悬停时的背景色,但它似乎不起作用。

您可以这样做:

div:first-child:hover::after {
    background-color: #44b800;
}

您不能
:将
悬停在伪类上<代码>:after
:before
不能那样工作。谢谢,我原以为是这样,但在搜索答案时找不到任何东西。
div:first-child:hover::after {
    background-color: #44b800;
}