Programming

Sass에서 의사 요소 선택기 : after 및 : before

procodes 2020. 6. 5. 21:55
반응형

Sass에서 의사 요소 선택기 : after 및 : before


이 질문에는 이미 답변이 있습니다.

Sass 또는 SCSS의 구문에 따라 : before 및 : after 유사 요소 선택기를 사용하려면 어떻게해야합니까? 이처럼 :

p
  margin: 2em auto
  > a
    color: red
  :before
    content: ""
  :after
    content: "* * *"

물론 위의 내용은 실패합니다.


앰퍼샌드를 사용하여 상위 선택기를 지정하십시오

.SCSS 구문 :

p {
    margin: 2em auto;

    > a {
        color: red;
    }

    &:before {
        content: "";
    }

    &:after {
        content: "* * *";
    }
}

참고 URL :

https://stackoverflow.com/questions/10750563/after-and-before-pseudo-element-selectors-in-sass

반응형