是否可以在img元素的psuedo选择器之前和之后使用?以为它是但没有运气,将css转换为div并且工作正常。 .page-overhang
类是img元素。
// page overhang mixin
@mixin overhang {
&:before,
&:after {
position: absolute;
left: 0;
display: block;
width: 10px;
height: 18px;
background: url(../images/sprite.png) no-repeat;
content: "";
}
&:before {
top: -18px;
background-position: 0 -100px;
}
&:after {
bottom: -18px;
background-position: 0 -119px;
}
}
/* scss file */
.page-overhang {
position: relative;
display: block;
@include overhang();
}