在我的样式表中将font-family设置为“ Goudy Trajan Regular”

时间:2019-04-07 22:21:22

标签: html css

我正在使用@ font-face在CSS样式表中定义字体系列。然后,当我尝试设置字体系列属性时,无法将新字体显示在HTML页面上。

@font-face {
    font-family: 'Goudy Trajan Regular';
    font-style: normal;
    font-weight: 400;
    src: local('Goudy Trajan Regular'), local('GoudyTrajan-Regular'),
        url(http://allfont.net/cache/fonts/goudy-trajan-regular_9c60d369eeef3d3ea1e3ddaa07f3e15f.woff) format('woff'),
        url(http://allfont.net/cache/fonts/goudy-trajan-regular_9c60d369eeef3d3ea1e3ddaa07f3e15f.ttf) format('truetype');
}
html, body
{
    height: 95%;
    width: 90%;
    font-family: 'Goudy Trajan Regular', arial;
}

更新:我已经剥离了所有内容,但仍然无法正常工作。这是我完整的CSS-

@font-face {
    font-family: 'Goudy Trajan Regular';
    font-style: normal;
    font-weight: 400;
    src: local('☺'),
        url(http://allfont.net/cache/fonts/goudy-trajan-regular_9c60d369eeef3d3ea1e3ddaa07f3e15f.woff) format('woff'),
        url(http://allfont.net/cache/fonts/goudy-trajan-regular_9c60d369eeef3d3ea1e3ddaa07f3e15f.ttf) format('truetype');
}
body
{
    font-family: 'Goudy Trajan Regular', arial;
}

这是我完整的HTML-

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="css/style2.css">
</head>
<body>
    <h1>TESTING A NEW FONT</h1>
</body>
</html>

0 个答案:

没有答案