April 2013
Intermediate to advanced
274 pages
5h 39m
English
However, while we can split media queries into a separate partial, hopefully, in this chapter, you'll be convinced there is a better way of authoring media queries with Sass.
Let's suppose a container needs to be different widths at different viewports. With Sass, we can produce exactly the same outcome as our prior example by writing the following code:
.style {
color: $color1;
@include MQ(Splus) {
width: 80%;
}
@include MQ(Mplus) {
width: 70%;
}
@include MQ(Lplus) {
width: 60%;
}
} After choosing a selector, any property and value pairs that will be identical across various viewport sizes (color and font-family perhaps) are declared.
Then, the various media query breakpoint styles are nested within. These nested media ...
Read now
Unlock full access