使用knitr导入html输出的字体类型



我正在尝试导入以下字体,以便在我的html输出中使用。它们已经包含在我的.css文件中,但它不起作用。

@import url('https://fonts.googleapis.com/css?family=Josefin+Sans:300,300i,400,400i,600,600i,700,700i');
@import url('https://fonts.googleapis.com/css?family=Fira+Sans:300,300i,400,400i,500,500i,600,600i,700,700i');
@import url('https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600');
h1, h2, h3 {
font-family: 'Josefin Sans, serif';
font-weight: normal;
}
body {
font-family: 'Fira Sans', serif;
}
.remark-code, .remark-inline-code { 
font-family: 'Source Code Pro', monospace;
}

我的YAML是这样的:

---
title: "title"
subtitle: "subtitle"
author:  "author"
date: "date"
output:
html_document:
toc: true # table of content true
toc_float: true
depth: 3  # upto three depths of headings (specified by #, ## and ###)
number_sections: false  ## if you want number sections at each table header
css: [style.css]
highlight: zenburn  # specifies the syntax highlighting style
fig.retina: 3
self_contained: yes
---

为什么我的html输出没有使用指定的字体?任何帮助都是非常受欢迎的!

在代码中进行以下更改

h1, h2, h3 {
font-family: 'Josefin Sans', serif;
font-weight: normal;
}
Right Way ->  font-family: 'Josefin Sans', serif;
Wrong Way ->  font-family: 'Josefin Sans, serif';

最新更新