我对自己在 Stack Overflow 上的第一篇文章感到非常兴奋。好久不见了!
一个问题:在下面的代码中,.1、.2 等的设置不适用。这是我的代码:
更少的代码:
@screen-lg-min: 1200px;
#laurels {
text-align:center;
margin: 0 auto;
@media (min-width: @screen-lg-min) {
width: 930px;
.1, .2, .3, .4, .5 {
width: 165px;
height: 76px;
padding: 0 5px;
}
}
}
HTML:
<div id="laurels">
<div class="lorel 1">
<div></div>
</div>
</div>
知道我可能做错了什么吗?
谢谢!
最佳答案
根据 W3Schools , 类名不能以数字开头。所以如果你改变你的
.1, .2, .3
等等
.one, .two, .three
等等。它将起作用。
当然,更改必须包括您的 div 上的类声明。
<div class="lorel one">
或者,如果您更喜欢使用数字,只需像这样在前面添加一些文本:
.style_1, .style_2, .style_3
关于html - 更少的样式 : Comma-separated div's nested within media query not applying,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20357407/