CSS导入字体不起作用 [英] css import font doesn't work

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

问题描述

我的p元素有问题.

这是我的html和CSS

here is my html and css

@font-face {
    font-family: 'Raleway Medium';
    src: url('Raleway-Medium.ttf') format('truetype');
}
.item_txt{
    padding-top : 10px;
    box-sizing: border-box;
    padding-right: 15px;
    padding-left: 95px;
    font-size: 21px;
    color : #F9F9F9;
    text-align: left;
    cursor: pointer;
    font-family: 'Raleway Medium' !important;
}

我尝试导入自定义字体,但失败.

I tried to import custom font but it failed.

<div class="col-sm-7 col-sm-offset-2">

            <div class="item_box">
                <img src="images/boardicon1.png" class='item_img'>
                <p class="item_txt">Mother Board</p>
            </div>
          </div>

ႈ这是项目目录.

推荐答案

将其放在样式表的顶部:

Put this at the top of your style sheet:

@import url('https://fonts.googleapis.com/css?family=Raleway');

使用该字体在某些元素上使用字体:

Than use this to use the font on certain elements:

p {
   font-family: 'Raleway', sans-serif;
}

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

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