我的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
| 归档时间: |
|
| 查看次数: |
440 次 |
| 最近记录: |