我有这个更少的代码,这工作得很好.我只想在较少cli编译时保存一些空格.
.secondary-content {
background: #ffcc80;
color: white !important;
label, i {
background: #ffcc80;
color: white !important;
}
}
Run Code Online (Sandbox Code Playgroud)
当我从命令提示符运行较少时,输出看起来像这样.
.secondary-content {
background: #ffcc80;
color: white !important;
}
.secondary-content label,
.secondary-content i {
background: #ffcc80;
color: white !important;
}
Run Code Online (Sandbox Code Playgroud)
正如你所看到的,它们在每个街区都是分开的.我想让他们在同一个街区.我怎样才能轻松合并父级和子级样式属性?像这样.
.secondary-content,
.secondary-content label,
.secondary-content i {
background: #ffcc80;
color: white !important;
}
Run Code Online (Sandbox Code Playgroud)
我还在少学习,所以任何帮助都会非常感激.
提前致谢
您可以使用父选择器(&),如下面的代码段所示.使用父选择器意味着相同的规则适用于.ghost .secondary-content选择器及其子label和i标记.
.ghost .secondary-content {
&, label, i {
background: #ffcc80;
color: white !important;
}
}
Run Code Online (Sandbox Code Playgroud)