选择器超出选择器最大特异性

问题描述

这是我拥有的 CSS:

.tab {
  border: 0;
  flex: 1 1 0;
  min-height: 48px;
  opacity: 1;
  text-align: center;
  z-index: 0;
}
.tab:not([data-selected]) {
  border-radius: 0;
}
.tab[data-selected] {
  background-color: $white;
  border: 1px solid #eee;
  z-index: 2;
}
.tab[data-selected]:first-of-type {
  margin-right: -8px;
}
.tab[data-selected]:last-of-type {
  margin-left: -8px;
}
.tab[data-selected]:not(:first-of-type):not(:last-of-type) {
  margin-left: -8px;
  margin-right: -8px;
}
.tab:first-of-type {
  border-bottom-left-radius: 12px;
  border-top-left-radius: 12px;
}
.tab:last-of-type {
  border-bottom-right-radius: 12px;
  border-top-right-radius: 12px;
}

这里有点问题:

.tab[data-selected]:not(:first-of-type):not(:last-of-type) {
  margin-left: -8px;
  margin-right: -8px;
}

我正在尝试选择中间孩子。我的 stylelint 是这样抱怨的:

Expected "`.tab[data-selected]:not(:first-of-type):not(:last-of-type)`" to have a specificity no more than "0,3,2"

我该如何更好地解决这个问题?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)