How can I specify CSS @media within a razor file?

asp.net Mvcasp.net Mvc-3Razor

asp.net Mvc Problem Overview


I have the following:

@if (Model.PageMeta.Sidebar == PageMetaSidebar.Small) { Html.RenderPartial("_SmallSidebar"); }

and in my include file:

<style "text/css">
    #sbr { width: 193px; }
    #lft { left: 205px; top: 85px; right:  5px; bottom: 30px; }
    #top { left: 215px; top: 85px; right: 15px; }
    #btm { left: 215px; right: 15px; bottom: 30px; }
    #mdl { left: 215px; top: 85px; right: 15px; bottom: 30px; }
    @media print {
        div#lft {left:10px; right: 10px; top: 0px;}
        div#top {left:20px; right: 20px; top: 0px;}
        div#btm {left:20px; right: 20px; }
        div#mdl {left:20px; right: 20px; top: 0px;}
    }
}
</style>

However this gives me a compile type error:

_SmallSidebar.cshtml(7): error CS0103: The name 'media' does not exist in the current context

Does anyone out there know how I could fix this so it accepts that @media is not something that needs to be evaluated?

asp.net Mvc Solutions


Solution 1 - asp.net Mvc

You can use @@ which razor ignores and prints one @.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJaneseView Question on Stackoverflow
Solution 1 - asp.net MvcBuildstartedView Answer on Stackoverflow