SASS - 在 :hover 时将转换器应用于 ::after

SASS - Applying changer to ::after when :hover

我正在尝试在 :hover 时对 ::after 元素应用更改,但它不起作用,这是我的代码,请告诉我哪里出了问题,谢谢!

&::after
  content: ""
  width: 100%
  height: 100%
  background:
    image: url('../img/couverture.jpg')
    size: cover
    position: center
    repeat: no-repeat
  //outline: 1px solid red
  position: absolute
  z-index: 1
  &::after:hover
    outline: 1px solid red

而不是

:after:hover

尝试

:hover:after

你应该像下面这样缩进后面的悬停:

.element {
    &:after {
        &:hover {
            styling:here;
        }
    }
}

我猜你渲染的 CSS 会像,

Element::after::after:hover{ outline: 1px solid red }

无效,:after 上的 hover 也无效。