如何添加自定义字体? [英] How do I add custom fonts?

查看:143
本文介绍了如何添加自定义字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在html网站上安装自定义字体?

How do I install a custom font on an html site?

例如,我在一个婚礼网站上工作,发现该主题有很多漂亮的字体,但我找不到正确的添加方法

For example, I was working on a wedding website, and I was finding a lot of nice fonts for that subject, but I can't find the right way to add that font to the server, or to include that font with CSS?

推荐答案

下载该字体并放在任何目录中。在这里,我在 fonts 目录中添加了

download your font and put in any directory. here i added in fonts directory

   <style>
    @font-face {
        font-family: 'maven_pro_light_300regular';
        src: url('fonts/mavenprolight-300-webfont.eot');
        src: url('fonts/mavenprolight-300-webfont.eot?#iefix') format('embedded-opentype'),
             url('fonts/mavenprolight-300-webfont.ttf') format('truetype'),
             url('fonts/mavenprolight-300-webfont.woff') format('woff'),
             url('fonts/mavenprolight-300-webfont.svg#maven_pro_light_300regular') format('svg');
        font-weight: normal;
        font-style: normal;
    }

    </style>

,您可以按照以下示例使用它:

and you can use it by follow example:

<style>
h2{
    font-family:maven_pro_light_300regular; 
}
</style>

这篇关于如何添加自定义字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆