我不能使用@font-face

I cannot use @font-face

我正在尝试实现一种自然语言形式。当我尝试在我的 CSHTML 页面中使用以下 CSS 时,我收到错误消息“名称 'font' 在当前上下文中不存在”

@font-face {
  font-family: 'nlicons';
  src:url('../fonts/nlicons/nlicons.eot');
  src:url('../fonts/nlicons/nlicons.eot?#iefix') format('embedded-opentype'),
    url('../fonts/nlicons/nlicons.woff') format('woff'),
    url('../fonts/nlicons/nlicons.ttf') format('truetype'),
    url('../fonts/nlicons/nlicons.svg#nlicons') format('svg');
  font-weight: normal;
  font-style: normal;
}

你必须转义 @ 标志。 @ 符号保留用于剃须刀语法。

转义@写两遍@@.

@@font-face {
  font-family: 'nlicons';
  src:url('../fonts/nlicons/nlicons.eot');
  src:url('../fonts/nlicons/nlicons.eot?#iefix') format('embedded-opentype'),
    url('../fonts/nlicons/nlicons.woff') format('woff'),
    url('../fonts/nlicons/nlicons.ttf') format('truetype'),
    url('../fonts/nlicons/nlicons.svg#nlicons') format('svg');
  font-weight: normal;
  font-style: normal;
}