Search code examples
lessmedia-queries

Less media-query variable returns ParseError: Expected ')'


I just started using Less and now I'm trying to convert my media query into a variable. What I want is this:

@mobile: only screen and (max-width: 750px);
@media @mobile;{
    body {
        font-size: 30px;
    }
}

But when I run my website it returns the following error:

ParseError: Expected ')' in main.less on line 1, column 27:

1 - @mobile: only screen and (max-width: 750px);

What am I doing wrong? :-(


Solution

  • @mobile: ~"only screen and (max-width: 750px)";
    @media @mobile {
        body {
            font-size: 30px;
        }
    }