【发布时间】:2018-08-30 06:37:54
【问题描述】:
我下载了一个项目,并在其中使用less 编写样式表。
而在脚本代码中name: own-space,在less代码中,有&-btn-box、&-tra和&-input-identifycode-con选择器。
我有两个问题:
-
我不知道less中的
.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: #0C25F1;
transition: all .2s;
}
}
}
&-tra {
width: 10px;
height: 10px;
transform: rotate(45deg);
position: absolute;
top: 50%;
margin-top: -6px;
left: -3px;
box-shadow: 0 0 2px 3px rgba(0, 0, 0, .1);
background-color: white;
z-index: 100;
}
&-input-identifycode-con {
position: absolute;
width: 200px;
height: 100px;
right: -220px;
top: 50%;
margin-top: -50px;
border-radius: 4px;
box-shadow: 0 0 2px 3px rgba(0, 0, 0, .1);
}
}
</style>
【问题讨论】:
-
请注意
&btn-box和&<newline>btn-box之间的区别(后者相当于& btn-box,然后最初发布的代码没有太大意义)。我帮你修好了。
标签: css css-selectors less