例如:

.icon-pinterest{
    color:#CC2027;
    background: #fff;
    &:hover{
        color:#CC2027;
        background: #fff;
    }
}


这将生成:

.icon-pinterest {
  color: #cc2027;
  background: #fff;
}

.icon-pinterest:hover {
  color: #cc2027;
  background: #fff;
}


但我想要以下内容:

.icon-pinterest,
.icon-pinterest:hover {
  color: #cc2027;
  background: #fff;
}


我想也许我可以使用扩展表达式?

最佳答案

这是不可能的,因为乍一看似乎并没有那么明智(例如,将鼠标悬停在默认样式已经相同的元素上),并且在某些罕见情况下,使用默认CSS语法仍然可以实现需要它。所以您只需使用

.icon-pinterest,
.icon-pinterest:hover {
  color: #cc2027;
  background: #fff;
}

10-05 20:39
查看更多