如何将字体添加到网页 [英] How to add font to a web page

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

问题描述

你如何为页面添加字体。



例如,假设我有一个特定的 .TTF 文件。



我想在特定的网页上使用此文件。现在所有的浏览器都以不同的方式处理不同的字体,在CSS中可以在 font-family 标记中添加字体文件。



对不起,如果这是无法解决或令人难以置信的简单我是CSS的新手。

字体文件夹和保存所有字体文件

  @ font-face {
font-family:'Archer-Semibold ;
src:url('fonts / archer-semibold-pro.eot');
src:url('fonts / archer-semibold-pro.eot?#iefix')格式('embedded-opentype'),
url('fonts / archer-semibold-pro.woff')格式('woff'),
url('fonts / archer-semibold-pro.ttf')格式('truetype'),
url('fonts / archer-semibold-pro.svg#archer -semibold-pro')格式('svg');
font-weight:normal;
font-style:normal;
}

.menu {
font-family:Archer-Semibold;

url('fonts / archer-semibold-pro .eot')用于IE 9并且 url('fonts / archer-semibold-pro.eot?#iefix')用于IE 6至8


How do you add a font to a page.

For example lets say I have a particular .TTF file.

And I want to use this file on a particular webpage. Now with all browsers processing different fonts differently is it possible in CSS to add the "font file" in the font-family tag.

I'm sorry if this is unsolvable or unbelievably simple I'm a newbie to CSS.

解决方案

Create the font folder and save all the font files

    @font-face {
        font-family: 'Archer-Semibold';
        src: url('fonts/archer-semibold-pro.eot');
        src: url('fonts/archer-semibold-pro.eot?#iefix') format('embedded-opentype'),
                 url('fonts/archer-semibold-pro.woff') format('woff'),
                 url('fonts/archer-semibold-pro.ttf') format('truetype'),
                 url('fonts/archer-semibold-pro.svg#archer-semibold-pro') format('svg');
        font-weight: normal;
        font-style: normal;
    }

.menu {
  font-family: Archer-Semibold;
}

url('fonts/archer-semibold-pro.eot') is use for IE 9 and url('fonts/archer-semibold-pro.eot?#iefix') is used for IE 6 to 8

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

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