Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@media media query and ASP.NET MVC razor syntax clash

use double @@ symbols. That will escape @ symbol and render @media correctly on client side


Also remember to add a space after double @@:

 @@ media only screen and (max-width : 960px)

@@media with no space did not work for me.


I realize this is old question, but this is the only solution that worked for me:

@section cphPageHead{
    <style type="text/css" media="screen and (max-width:959px)">
    </style>


    <style type="text/css" media="screen and (min-width:960px)">
    </style>
}