Scss:Selector继承:删除一个声明 [英] Scss : Selector Inheritance : removing one declaration
本文介绍了Scss:Selector继承:删除一个声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法从scss中的扩展选择器中删除声明?
Is there a way to remove the declaration from the extended selector in scss?
示例如下:
#logo {
float: left;
width: 75px;
height: 28px;
background: url("/images/logo.png") no-repeat 0 0;
a {
@extend #logo;
background: none;
display: block;
text-decoration: none;
text-indent: -999999em;
overflow: hidden;
}
}
而不是使用
background:none;
background: none;
推荐答案
没有撤消。你必须创建一个单独的选择器,两个选择器都从:
There is no "undo". you'll have to create a separate selector that both selectors extend from:
%logo-common {
float: left;
width: 75px;
height: 28px;
}
#logo {
@extend %logo-common;
background: url("/images/logo.png") no-repeat 0 0;
a {
@extend %logo-common;
display: block;
text-decoration: none;
text-indent: -999999em;
overflow: hidden;
}
}
编译为:
#logo, #logo a {
float: left;
width: 75px;
height: 28px;
}
#logo {
background: url("/images/logo.png") no-repeat 0 0;
}
#logo a {
display: block;
text-decoration: none;
text-indent: -999999em;
overflow: hidden;
}
这篇关于Scss:Selector继承:删除一个声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文