When working with Sass Mixins, it is necessary to utilize media queries in order to explicitly adjust the grid layout. My approach involves creating a Mobile First website and then duplicating the Sass code defining the grid into two separate media queries:
// Mobile Grid
@media only screen and (max-width: 768px) { ... }
// Desktop & Tablet Grid
@media #{$small} { ... }
Despite my efforts, I struggled to find clear examples illustrating this process. While it is theoretically possible to define the grid in Sass and override it using the @media #{$small} {}
media query, I encountered difficulties making it work in practice. Regardless of whether I placed the media query before or after the original grid declaration, the initial grid configuration persisted.
For a more detailed example, consider the case of the #dashboard
element stacking and centering on mobile devices, while displaying as a 3-column layout on desktops and tablets. This would translate to
class="small-10 small-centered large-4 columns"
when using presentational classes.
// Mobile Grid
@media only screen and (max-width: 768px) {
#dashboard { @include grid-row;
& > #stats { @include grid-column(10, false, true); }
& > #records { @include grid-column(10, false, true); }
& > #results { @include grid-column(10, false, true); }
}
}
// Desktop & Tablet Grid
@media #{$small} {
#dashboard { @include grid-row;
& > #stats { @include grid-column(4, false, false); }
& > #records { @include grid-column(4, false, false); }
& > #results { @include grid-column(4, false, false); }
}
}
Please remember that you can further customize this approach by incorporating additional breakpoints using mixins. However, the provided method closely mirrors the default Zurb F4 presentational class behavior.