如何使用文件系统HTML CSS中的字体

时间:2019-05-18 21:36:01

标签: html css

我有一个要使用的字体文件,称为Gotham Light Regular。您将如何访问该文件以更改字体?下面是我现在所拥有的,但是它不起作用。

uart.write(1,
.name{
    font-family: myFirstFont;
}

1 个答案:

答案 0 :(得分:1)

将字体文件放置到可访问网络的位置,并为其放置适当的CSS。

您可以从互联网上下载该字体(例如cufonfonts),也可以在计算机上找到您的字体文件(example)。

然后放入CSS:

@font-face {
    font-family: 'GothamLight';
    src: url('/fonts/Gotham-Light.eot');
    src: url('/fonts/Gotham-Light.otf') format('opentype'),
         url('/fonts/Gotham-Light.eot?iefix') format('embedded-opentype'),
         url('/fonts/Gotham-Light.woff') format('woff'),
         url('/fonts/Gotham-Light.ttf') format('truetype'),
         url('/fonts/Gotham-Light.svg#gothamlight') format('svg');
}


body {
   font-family: GothamLight;
}
相关问题