Hello, I'm currently involved in a project where I have implemented media conditions for my columns using Sass.
Here is the code snippet:
// Mobile media - 320px width
@mixin mobile{
@media only screen and (max-width:767px){
width: 300px;
}
}
Below is the code snippet for looping through my columns:
@for $col from 1 through $grid-cols{
.col-#{$col}{
@include mobile;
}
}
where $grid-cols = 12
Thus, the CSS output looks like this:
@media only screen and (max-width: 767px) {
.col-1 { width: 300px; } }
@media only screen and (max-width: 767px) {
.col-2 { width: 300px; } }
...continuing till .col-12
I am aiming for the output to be:
@media only screen and (max-width: 767px) {
.col-1, .col-2 { width:300px; }
If anyone has any suggestions, please share. Thank you!