2

I’m trying to implement a natural language form. When I’m trying to use the following CSS in my CSHTML page, I get the error “the name 'font' does not exist in the current context”

@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;
}
Sebastian Simon
  • 18,263
  • 7
  • 55
  • 75
Ardis thrash
  • 164
  • 9
  • Check, The path you are giving in 'src' must be correct and font must be there. Then use[ font-family: 'nlicons';] to the html element where you want to display this fonts. – Front End Coder Sep 25 '19 at 13:20

1 Answers1

3

You have to escape the @ sign. The @ symbol is reserved for razor syntax.

To escape @ write it twice @@.

@@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;
}
tom
  • 9,550
  • 6
  • 30
  • 49