To utilize variables in media queries with Sass 3.2 and higher is necessary. To determine the version you are currently using, execute this command in Terminal:
gem list | grep sass
If you need to obtain the 3.2 alpha version, you can do so by entering:
(sudo) gem install sass --pre
Presumably, you're interested in utilizing pixels as units, so once the 3.2+ version is installed, you can simplify your code like this:
@for $i from 1 through 12 {
@media screen and (min-width: $i * 240px) {
width: $i * 240px + (20*($i - 1));
}
}
Note the use of 240px
instead of just
240</code, as well as the addition of space between <code>$i - 1
.