![]() |
1
3
它引用父选择器。 输入:
输出:
如果你是用BEM格式写CSS的话,这真的很有帮助,比如:
最后,我共享的所有示例都连接了类名,但您也可以将其用作引用,例如:
http://lesscss.org/features/#parent-selectors-feature https://blog.slaks.net/2013-09-29/less-css-secrets-of-the-ampersand/ Using the ampersand (SASS parent selector) inside nested selectors |
![]() |
2
1
这是Sass的一个内置功能: https://css-tricks.com/the-sass-ampersand/ 二者都 分为两类:
你想筑巢,Sass的等价物是:
|
![]() |
Henry · scss或css中的calc函数不起作用 2 年前 |
![]() |
Glen Elkins · SASS新手-不编译 6 年前 |
![]() |
zed · 防止SCS编译CSS变量-Angular CLI 6 年前 |
![]() |
sliptype · 使用Webpack提取CSS时抑制模块输出 6 年前 |