是否可以在其父元素中包含伪元素 css

Is it possible to include the pseudo element inside it's parent element css

我想格式化我的 css,使每个相关元素都在它们自己的 class 中,包括 class 的伪元素。 目前,伪元素是这样格式化的。

element {
   ...
}

element::after {
   ...
}

是否可以将上面的格式化成这种格式?基本上将伪元素嵌套在它的父元素中。

element {
   ...
   element::after {
      ...
   }
}

不适用于原版 css。
您有几个选项,例如 Scss, Less, Stylus and Postcss(with a plugin).

如果你刚开始,我推荐 Scss:

.element {
  &::after {
  }
}