html - 使用本地存储在计算机上的字体,不起作用

标签 html css fonts

                        @font-face {
                            font-family: 'Runescape Chat Font Regular' !important;
                        src:
                            local('Runescape Chat Font Regular'),
                            local('Runescape Chat Font Regular'),
                            url('Runescape Chat Font Regular.ttf');
                        }

.

                      .message-group.compact .message .message-text .markup .user-name {
                            font-family: 'Runescape Chat Font Regular', sans-serif !important;
                            font-size: 13px !important;
                            font-weight: 100 !important; 
                        }

我正在尝试使用安装在我的计算机上的字体,但它不起作用。我的代码有错误吗?未显示 Runscape Chat Font Regular 字体。 (这是给一群会预装字体的 friend ,所以必须要安装字体才能正常工作)

最佳答案

你好,这就是你在 css 中引用字体的方式

@font-face {
   font-family: myFirstFont;
   src: url(sansation_light.woff);
}

引用这个@font-face rule css

请参阅 learn more

关于html - 使用本地存储在计算机上的字体,不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40128864/

相关文章:

android - 在 androidx 中使用自定义字体

javascript - 最近的元素和 prev()

html - CSS 中的四边形梯形

javascript - 链接到新 HTML 页面中的某个部分

javascript - 使用 html/javascript 代码编辑外部 CSS

html - 定位列表组元素按钮

javascript - 使用 JS 通过 getElementsByClassName() 访问多个元素

jquery - 弹出框内容溢出时不显示弹出框箭头

css - 自托管字体 - 不适用于 IE 9

vb.net - Winforms::为什么更改表单字体会调整某些控件的大小?