在scss中向后嵌套? [英] Make backward nesting in scss?
本文介绍了在scss中向后嵌套?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法在scss中向后嵌套? 在 css 中,当我想覆盖IE或其他浏览器特定样式的样式时,我希望选择器紧随其覆盖的样式之后.像这样
Is there a way to nest backwards in scss? In css when I want to override style becourse of IE or other browser specific styles I like the selector to be right after the style it selector it overrides. Like this
css
.class-a .class-b{ color: pink }
.ie6 .class-a .class-b{ color: blue}
在scss中可能吗?因为现在我这样写(我不喜欢)
Is that possible in scss? Because right now I write it like this (and I dont like it)
scss
.class-a{
.class-b { color: pink }
.othercss { bla bla bla: sdfsd }
.fsdfsd { dfsdfs: sdfsd }
}
}
body.ie7 .class-a .class-b{ color:blue }
推荐答案
您正在寻找&
父选择器.
.class-a{
.class-b {
color: pink;
.ie7 & {
color: blue;
}
}
.othercss { bla bla bla: sdfsd }
.fsdfsd { dfsdfs: sdfsd }
}
http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html #referencing_parent_selectors_
这篇关于在scss中向后嵌套?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文