我正在使用CMS,我只能访问CSS文件。因此,我不能在文档的<head>中包含任何内容。我想知道是否有一种方法可以从CSS文件中导入web字体?
当前回答
使用@import标记
@import url('http://fonts.googleapis.com/css?family=Kavoon');
其他回答
下载字体ttf/其他格式文件,然后简单地添加下面的CSS代码示例:
@font-face {font-family: robot -regular; src: url(. . /字体/ Roboto-Regular.ttf);} h2 { 字体类型:roboto-regular; }
你也可以使用@font-face链接到url。 http://www.css3.info/preview/web-fonts-with-font-face/
CMS支持iframe吗?您还可以在内容的顶部放置iframe。这可能会更慢——最好将它包含在CSS中。
通过链接就可以了
https://developers.google.com/fonts/docs/getting_started
将其导入样式表使用
@import url('https://fonts.googleapis.com/css?family=Open+Sans');
<link href="https://fonts.googleapis.com/css?family=(any font of your
choice)" rel="stylesheet" type="text/css">
要选择字体,您可以访问链接:https://fonts.google.com
写你选择的字体名称从网站排除括号。
举个例子,你选择了龙虾字体,
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet"
type="text/css">
然后你就可以在整个HTML/CSS文件中使用它作为字体族了。
例如
<h2 style="Lobster">Please Like This Answer</h2>
自2015年以来,谷歌方面发生了一些变化。我有一些困难找到它,包括新的方法:
向下滚动所需的字体页面 点击字体名称旁边的小加号图标 嵌入链接和其他选项将出现在网页右侧的“所选家庭”对话框中。