通常hover后面跟的选择器,都是在myClass结构之下 的dom元素。

如果想在myClass下添加after等,就需要两个::号。

注:after/before是属于myclass的下级元素,并不是同级

.myClass:hover::after{
  
  content: '';
  display: block;
  background: url(../images/category_icon/forbid_red.png) no-repeat 14px 15px;
  height: 30px;
  width: 30px;
  background-size: 15px;
}

 

相关文章: