html - 如何在 <select> 标签中呈现自定义字体?

标签 html asp.net-mvc-3 fonts

我有一组自定义字体(不是系统字体),我想在我的一个页面 (MVC 3) 中使用它们。我想在 <select> 中显示该字体标记,但是否可以将每个元素内的文本呈现为其字体样式?

换句话说,我想渲染例如字体 enter image description here

在选择的标签项之一中

最佳答案

是的,您可以像这样在 CSS 中声明它:

 @font-face { font-family: urfont; src: url('urfont.otf'); } 
 @font-face { font-family: urfont; font-weight: bold; src: url('urfont.otf');}

然后,您可以像其他标准字体一样引用它:

<select style="font-family: urfont, sans-serif;"

关于html - 如何在 <select> 标签中呈现自定义字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10329415/

相关文章:

html - @fontface - zen cart 中的 403-forbidden 错误

html - 如何从 bootstrap 4 中删除下划线和文本悬停

html - 使用浏览器窗口调整高度的两个 div 底部 div

jquery - 将图像设置为 div

css - 我应该如何更改列表的顺序

delphi - 更改所有对话框的整个字体名称(第 2 部分)

html - 居中响应文本

c# - 将 ViewData 传递给部分 View

c# - System.Web.Mvc.HtmlHelper' 不包含 CheckBox 的定义

html - 建立 Font Awesome 图标