-1

I'd like to manage the heightens of image using a variable in saas, instead of using percentages, I'd like to define different values based on different

How can I do that in saas files ?

I did this, but I got error message saying

Invalid CSS after "only screen ": expected media query list, was "{ $ratio: 24px }" on line 10

Here is what I did:

// Small screens
@media only screen { $ration: 24px } 

@media only screen and (max-width: 40em) { $ration: 14px }

// Medium screens
@media only screen and (min-width: 40.063em) { $ration: 22px } 
@media only screen and (min-width: 40.063em) and (max-width: 64em) {$ration: 4px }


// Large screens
@media only screen and (min-width: 64.063em) {$ration: 24px } 

@media only screen and (min-width: 64.063em) and (max-width: 90em) {$ration: 24px } 

// XLarge screens
@media only screen and (min-width: 90.063em) { $ration: 24px } 

@media only screen and (min-width: 90.063em) and (max-width: 120em) { $ration: 24px } 

// XXLarge screens
@media only screen and (min-width: 120.063em) { $ration: 24px } 

UPDATE

//mobile:  320px,
//tablet:  740px,
//desktop: 980px,
//wide:    1300px


@function test() {
    @if ($HOW_TO_Get_WIDTH == 320px ) {

        return 22px;
    } @else if ($HOW_TO_Get_WIDTH == 740px) {
        @return 24px
    }
}
user3378649
  • 5,154
  • 14
  • 52
  • 76

1 Answers1

-1

This is not possible. The trigger @media only screen happens on the client-side. You could do it by hand smth like this:

@media only screen and (min-width: 64.063em){
      $ration: 24px; // you need to indent it to (re)set it just within this media-query
      // now you copy all the css rules/properties that contain or are relative to $ration e.g.
      #wrapper{
          width: $ration; //or your needed property
      }
 }

@media only screen and (min-width: 40.063em){
    $ration: 22px;
    #wrapper{
        width: $ration;
    }   
}

Example http://jsfiddle.net/h3604jsr/2/

zhuzhik
  • 41
  • 9