【发布时间】:2020-01-25 16:49:30
【问题描述】:
我正在尝试实现一种自然语言形式。当我尝试在我的 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;
}
【问题讨论】:
-
检查,您在“src”中提供的路径必须正确,并且字体必须在那里。然后使用 [ font-family: 'nlicons';] 到要显示此字体的 html 元素。