名称为“媒体”并不在目前的情况下存在 [英] The name 'media' does not exist in the current context
本文介绍了名称为“媒体”并不在目前的情况下存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在一个ASP.NET MVC 3剃须刀观点,我有code:
In an ASP.NET MVC 3 razor view, I have the code:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
@media print
{
table { page-break-inside:auto; width: 100%; }
tr { page-break-inside:avoid; page-break-after:auto }
thead { display:table-header-group }
tfoot { display:table-footer-group }
}
</style>
</head>
<body>
<table>
不过,我得到了错误:
However I got the error:
The name 'media' does not exist in the current context.
感谢。
推荐答案
的 @
在剃刀保留字符。但是你可以用它逃离 @@
:
The @
is a reserved character in Razor. But you can escape it using @@
:
@@media print
这篇关于名称为“媒体”并不在目前的情况下存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文