jQuery无法识别CSS伪代码

rcs*_*s20 9 css jquery

我的CSS伪代码不被jQuery识别:这是我的代码

CSS:

h1 {
    background: red;
    width: 100px;
    display: inline-block;
}

h1:after {
    content:" | ";
    background:blue;
    display: inline-block;
}
Run Code Online (Sandbox Code Playgroud)

然后在jQuery我做:

console.log($('h1').css('backgroundColor'));
Run Code Online (Sandbox Code Playgroud)

显示:

rgb(255, 0, 0)

但当我这样做时:

console.log($('h1:after').css('backgroundColor'));
Run Code Online (Sandbox Code Playgroud)

显示:

undefined

Did*_*hys 16

您不能选择css伪元素,因为它们实际上并不存在于DOM中