css - 在没有互联网连接的情况下使用下载的字体

标签 css fonts

可以在没有互联网连接的情况下在本地网页 (XAMPP) 上使用下载的字体吗?我需要这个来查看字体,因为有些人可能负担不起互联网连接费用,他们使用计算机只是为了工作。

这是网络字体:http://openfontlibrary.org/en/font/didact-gothic

我尝试了这个但没有成功:http://css-tricks.com/snippets/css/using-font-face/

提前致谢!!!

编辑

我认为文件存储的地方是问题,因为我有这个 .css 但没有工作。我所有文件的位置是 /opt/lammp/htdocs

@font-face {
    font-family: 'DidactGothicMedium';
    src: url('didactgothic.eot');
    src: url('didactgothic.eot') format('embedded-opentype'),
         url('didactgothic.woff') format('woff'),
         url('didactgothic.ttf') format('truetype'),
         url('didactgothic.svg#DidactGothicMedium') format('svg');
}

p {
  font-family: 'Didact Gothic';
  font-weight: normal;
  font-style: normal;
  padding-left: 25px;
  padding-right: 25px;
} 

input {
  font-family: 'Didact Gothic';
  font-weight: normal;
  font-style: normal;
} 

最佳答案

是的,这是可能的,如果您只是在浏览器中转到您的本地主机,它应该像您将其转发并使用您自己的 IP/域转到那里时一样工作。

如果 @font 不适合您,请确保 1) 您使用的是 Chrome/Firefox(Internet Explorer 仅支持某些文件扩展名(我认为是 .otf)。

和 2) 您的路径设置正确!

也许您的一些 html/css 代码可以帮助我们解决您的问题 :)

关于css - 在没有互联网连接的情况下使用下载的字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19380383/

相关文章:

html - 如何在中心并排放置 2 个 iframe?

html - 如何将 .woff 字体导入我的网站

css - 媒体查询 x IE11

apache-flex - flex 使用的默认字体是什么?

jquery - 带有容器 Div 的图片库

android - Android 中的标准化屏幕尺寸

javascript - 是否可以对同一元素使用 2 种不同的字体,一种用于英语,另一种用于泰米尔语(unicode)

Android - 将自定义字体应用到 TextView 中不起作用

fonts - javafx 实际默认字体

css - 按选择器样式抓取查找