CSS — scss ampersand &-a selector based on a different parent.

blossom0417
1 min readSep 12, 2018

--

This is really useful for qualifying a selector based on a different parent.

  • 부모가 다르나 똑같은 자식이 있을경우
  • button 클래스를 각각 다른 부모에 있을경우 수정하려 한다면.

#scss

.button {   
body.page-about & {
...
}
}

#css

body.page-about .button {}

#reference

https://css-tricks.com/the-sass-ampersand/

--

--

No responses yet