html - github页面字体和index.html不起作用
问题描述
我在我的博客 alireza.one 的 github 上创建了一个 repo,现在我想创建一个波斯博客,我有两个问题:
第一:字体不加载。我在我的 css 上放了一条导入行,但它没有加载。
@import url('https://alireza.one/farsi/assets/type.css');
我的波斯语(波斯语)博客加载了我的主 CSS,但没有加载字体。我的存储库:alirezahy/farsi。我的网页:alireza.one/farsi
第二:我的 index.html(在波斯语 repo 和 alirezahy.github.io 中)是这样的:
---
layout: default
title: Index
---
<div class="listing">
{% for post in paginator.posts %}
<div class="post other link">
<h2></span> <a href="{{site.url}}{{post.url}}">{{ post.title }}</a></h2>
<p class="post-date">{{ post.date | date_to_string }}</p>
</div>
{% endfor %}
</div>
我怎样才能使它成为一个正常的 index.html 以便我的首页看起来像一个正常的博客而不是一个站点页面。
解决方案
如果要添加字体,则需要在 css 文件中像这样添加它:
@font-face {
font-family: "myFont";
src: url(fontofallknowledge.woff);
}
然后你可以像这样使用字体
body{
font-family: "myFont";
}
您将使用 @import 来导入样式表。
要回答您的第二个问题,您似乎在 .html 文件中使用了 php。你不可以做这个。
推荐阅读
- flutter - 如何在显示小部件时自动播放音频文件
- php - img 的来源:PHP 网站(VSCode 和 XAMPP)中的“/images/...”与“images/...”
- angular - 使用 Angular 前端部署 .NETCore API 时出错 - HTTP 错误 500.0 - ANCM 进程内处理程序加载失败
- android - 在一个查询中从两个表中删除而不加入
- git - 如何在 jenkins 多分支脚本管道中获取最新的 git 提交作者姓名或消息并在分支条件下使用
- javascript - 将值分配给计算属性 vuejs
- r - 如何在 R 中整个 data.frame 列的函数之间使用?
- python - Ebay 令牌和 GetDealItems API 调用问题
- java - 如何从java中的数组列表生成二维码并存储到数据库?
- laravel - Laravel [ErrorException] hash_file():读取 8192 字节失败,errno=13 权限被拒绝,Windows 操作系统