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

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 compilation type error:

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

Does anyone know how I can fix this, so he agrees that @media is not something to be appreciated?

+54
asp.net-mvc asp.net-mvc-3 razor
Jul 29 '11 at 13:10
source share
1 answer

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

+136
Jul 29 '11 at 13:21
source share



All Articles