CSS字体无效 [英] CSS font-face does not work

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

问题描述

我正在尝试将自定义字体添加到我的网站.我尝试了很多事情,但没有成功.这是我的CSS代码:

I am trying to add a custom font to my website. I have tried lots of things but didn't succeed. Here is my css code:

@font-face
{
    font-family: myFirstFont;
    src: url('ellis.ttf');
}

body
{
    margin: 0;
    padding: 0;
    width: 100%;
    cursor: default;
    font-size: 11px;
    line-height: 1;
    font-family: myFirstFont,arial,san-serif;
    overflow:auto;
    background:#ecf6f7;
}

我知道这不是跨浏览器的情况,但是我首先想使工作成为一个简单的情况.

I know this is not a cross browser case, but I am trying to make work a simple case at first.

推荐答案

应用这样的字体.

@font-face
{
    font-family: 'ellis';
    src: url('ellis.ttf');
}
.body
{
    font-family: "ellis";
}

这篇关于CSS字体无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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