参考
https://www.cnblogs.com/wonyun/p/5807191.html
自己的理解
所谓的伪元素就是该元素的前一个元素或者后一个元素
例如
<body>
<style>
.all::after{
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.3) url(../assets/selected.png) no-repeat center / 50px 50px;
}
<style>
<html>
<div class ="all">这是.all里面的内容</div>
<html>
</body>
这个结构其实是
<body>
<style>
.all::after{
content: '这是.all元素后面的span';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.3) url(../assets/selected.png) no-repeat center / 50px 50px;
}
<style>
<html>
<div class ="all">
这是.all里面的内容
<span>这是.all元素后面的span</span>
</div>
<html>
</body>
也就是.all::after的样式是span标签的样式