通常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; }