我正在使用Prepros将我的SCSS文件编译为CSS,但是当我尝试使用媒体查询时,它会给我一个错误。我也尝试过Coala和Scout。 如果我只是将此代码复制到输出CSS中就可以了。 我做错了什么?
@media only screen and (max-width: 320px) {
body {
width: 320px;
}
.wrapper {
width: 320px;
margin: 0 auto;
}
.works-wrap {
width: 320px;
}
}
@media only screen and (min-width: 320px) and (max-width: 610px) {
.wrapper {
width: 320px;
margin: 0 auto;
}
.works-wrap {
width: 320px;
}
}
@media only screen and (min-width: 610px) and (max-width: 950px) {
.wrapper {
width: 650px;
margin: 4% auto;
}
.name {
width: 100%;
}
.works-wrap {
width: 650px;
margin-left: 10px;
}
}
@media only screen and (min-width: 950px) and (max-width: 1024px) {
.wrapper {
width: 950px;
margin: 4% auto;
}
.name {
width: 100%;
}
.works-wrap {
width: 950px;
}
}
错误代码:
Error: Invalid CSS after "": expected selector, was "@media only scr..."
on line 169 of style.scss
164: width: 650px;
165: margin-left: 10px;
166: }
167: }
168:
169: @media only screen and (min-width: 950px) and (max-width: 1024px) {
170: .wrapper {
171: width: 950px;
172: margin: 4% auto;
173: }
174: .name {
Backtrace:
style.scss:169
c:/Program Files (x86)/Prepros/resources/app/ruby/ruby_gems/gems/sass-3.4.9/lib/sass/scss/parser.rb:1165:in `expected'
答案 0 :(得分:0)
试试这是一个复制/粘贴错误
@media only screen and (max-width: 320px) {
body {
width: 320px;
}
.wrapper {
width: 320px;
margin: 0 auto;
}
.works-wrap {
width: 320px;
}
}
@media only screen and (min-width: 320px) and (max-width: 610px) {
.wrapper {
width: 320px;
margin: 0 auto;
}
.works-wrap {
width: 320px;
}
}
@media only screen and (min-width: 610px) and (max-width: 950px) {
.wrapper {
width: 650px;
margin: 4% auto;
}
.name {
width: 100%;
}
.works-wrap {
width: 650px;
margin-left: 10px;
}
}
@media only screen and (min-width: 950px) and (max-width: 1024px) {
.wrapper {
width: 950px;
margin: 4% auto;
}
.name {
width: 100%;
}
.works-wrap {
width: 950px;
}
}
在@media only screen and (min-width: 610px) and (max-width: 950px)
的结束括号之后有一个隐藏字符只是将其删除