Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Sass中选择当前元素_Sass - Fatal编程技术网

在Sass中选择当前元素

在Sass中选择当前元素,sass,Sass,Sass是否有一个选择器来引用当前嵌套级别的元素?这样可以避免类似的重复: .something { color: red; a { color: red; // a tags are already styled globally } } 我可以写这个 .something { self, a { color: red; } } Sass 3.3-@at_root中有一个很好的新特性 .something {

Sass是否有一个选择器来引用当前嵌套级别的元素?这样可以避免类似的重复:

.something {
    color: red;
    a {
        color: red; // a tags are already styled globally
    }
}
我可以写这个

.something {
    self, a {
        color: red;
    }
}

Sass 3.3-@at_root中有一个很好的新特性

.something {
    &, a {
        color: red;
    }
 }
您可以在此处找到更多使用此功能的变体:


这个问题的可能重复是不同的,我想设置样式,不管东西是否有类。太棒了!你能解释一下#{&}的作用吗?#{something here}-它是一个简单的插值,&-链接到父元素