Sass, @media “767px is not a valid css value”

800 Views Asked by At

I can't run the project, because of this error. enter image description here

Declaration :

$max767 : only screen and (max-width: 767px);

here is the code that is causing the problem :

@media #{$max767} {
  .fc-left,
  .fc-right,
  .fc-center {
    display: flex;
    float: none;
    justify-content: center;
    margin-bottom: $module-rem;
  }
}

thanks in advance.

2

There are 2 best solutions below

4
houssk On

You should declare $max767 in string format $max767: "(max-width : 767px)"

0
Dan Mullin On

Your syntax is just a little off. This works:

$max767: “only screen and (max-width: 767px)”;
@media #{$max767} {
    /* css here */
}