为什么我的第一个 child 选择器在 Less 中不起作用?
.leftPanel{
margin:20px;
float:left;
display:inline;
width:620px;
margin-left:10px;
select{
width:300px;
&:first-child{
margin-right: 30px;
}
}
}
最佳答案
您指定如果 .leftPanel
中的第一个子元素是 <select>
, 它应该有 margin-right: 30px;
.如果您尝试将此规则应用于第一个子元素 inside <select>
(应该始终是 <option>
),尝试替换 &:first-child
与 option:first-child
.
关于css - 少一胎,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11775300/