如何将字体添加到网页

cjd*_*jds 0 html css

如何向页面添加字体.

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

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

我很抱歉,如果这是无法解决或难以置信的简单,我是CSS的新手.

vus*_*san 5

创建字体文件夹并保存所有字体文件

    @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;
}
Run Code Online (Sandbox Code Playgroud)

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