试图导入本地字体,但它无法正常工作

时间:2018-04-15 23:37:14

标签: html css fonts

所以我试图导入本地字体,但由于某些原因它无法被识别,我可以获得一些快速帮助,我会在哪里出错吗?

我目前有3个文件:索引页面,stylesheet.css和fonts.css。 我试图使用字体' cinzel'但是它没有用。

索引页面:     

<html>
<head>
    <link rel="fonts" type="text/css" href="css/fonts/fonts.css"/>
    <link rel="stylesheet" type="text/css" href="css/stylesheet/stylesheet.css"/>
    <style type="text/css">



    </style>
    <title>
        RENTDrive
    </title>
</head>

<body>
    <h1> RENTDrive </h1>

    <hr>


    <h3> Lots of exotic cars to choose from</h3>
    <a href="fleet.html">Book your vehicle now!</a> <p> Terms and conditions apply</p>
</body>

stylesheet.css页面:

h1 {
    font-family: 'cinzel';
}

h3 {
    font-family: 'cinzel';
}

fonts.css页面:

@font-face {
    font-family: 'cinzel';
    src: url('css/fonts/Cinzel-Regular.otf') format('opentype'),
         url('css/fonts/CinzelDecorative-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

2 个答案:

答案 0 :(得分:0)

可以将rel更改为样式表。

<link rel="stylesheet" type="text/css" href="css/fonts/fonts.css"/>

答案 1 :(得分:0)

标题标记的默认字体粗体是粗体(在用户代理样式表中)。 所以,您将删除font-weight: normal,您可以看到

相关问题