# img 设置伪类无效
Opened this issue · 0 comments
Shenchuanhuan commented
给img标签设置伪类,并不会生效。
对比如下:
<div class='testDiv'></div>
<img class='testImg' />
.testDiv {
position: relative;
width: 50px;
height: 50px;
background-color: black;
}
.testDiv:after {
content: '';
position: absolute;
width: 20px;
height: 20px;
background-color: green;
}
.testImg {
position: relative;
left: 100px;
width: 50px;
height: 50px;
background-color: black;
}
.testImg:after {
content: '';
position: absolute;
width: 20px;
height: 20px;
background-color: green;
}