Using Sass, I have the following mixin:
@mixin ss($property, $value, $value-smallscreen) {
#{$property}: $value;
@media screen and (max-height: $smallscreen-maxheight) {
#{$property}: $value-smallscreen;
}
}
.Header
{
@include ss('height', $RowHeight, $RowHeight-smallscreen);
@include ss('font-size', $HeaderFontsize, $HeaderFontsize-smallscreen);
}
The ‘problem’ that I have is that this generates two @media statements. That is, it generates the following CSS:
.Header {
height: 41px;
font-size: 11pt; }
@media screen and (max-height: 768px) {
.Header {
height: 35px; } }
@media screen and (max-height: 768px) {
.Header {
font-size: 9pt; } }
What I want to know, is there any way to both:
- Keep the definitions together, to ensure that the styles are added for both big and small screens, and
- Only have one '@media' section.