这是没有记录还是不可能?
#parent {
#child {
width: 75%;
.additional_parent_class & {
width: 50%;
}
}
}
Run Code Online (Sandbox Code Playgroud)
这基本上会变成:
.additional_parent_class #parent #child {
width: 50%;
}
Run Code Online (Sandbox Code Playgroud)
虽然这是有道理的,因为&符号的实现及其使用方式.如果我想要实现这一点怎么办?
#parent.additional_parent_class #child {
width: 50%;
}
Run Code Online (Sandbox Code Playgroud)
我能够实现这一目标的唯一方法是在子声明之外编写另一条规则:
#parent{
#child {
width: 75%;
}
&.additional_parent_class #child {
width: 50%;
}
}
Run Code Online (Sandbox Code Playgroud)
虽然这不一定是这个实现中的"痛苦",但如果#child有自己的孩子,现在需要在两个规则中重复,这似乎会产生反作用.
无论如何,也许我只是挑剔,但如果有更多方法可以遍历选择器,那将会很棒.
我下载了一个项目,并在其中使用less编写样式表。而在脚本代码name: own-space,并在less代码中,还有&-btn-box,&-tra和&-input-identifycode-con选择。
我有两个问题:
我不知道.own-space少与name: own-space的关系。
这有什么意义&-btn-box,&-tra并&-input-identifycode-con在那里?它们的功能是什么?
我的代码如下:
<template>
<div>
.....
</div>
</template>
<script>
export default {
components: {
},
name: 'own-space',
data () {
...
};
},
methods: {
...
}
};
</script>
<style lang="less" rel="stylesheet/less">
...
.own-space {
&-btn-box {
margin-bottom: 10px;
button {
padding-left: 0;
span {
color: #2D8CF0;
transition: all .2s;
}
span:hover {
color: …Run Code Online (Sandbox Code Playgroud)