我如何在HTML中使用这两种字体

How can I use this 2 Fonts in HTML?

本文关键字:两种 字体 HTML      更新时间:2023-09-26

http://www.myfont.de/fonts/infos/5512-Bar-Code-39-lesbar.html

如何在HTML5网页中使用此字体?

.ft14{font: 20pt 'code39';line-height: 15px;}

不工作。。

您必须首先下载字体并将其上传到某个地方。然后使用CSS3@font face

@font-face {
  font-family: 'Font_Name';
  font-style: fontstyle;
  font-weight: Font-weight;
  src: local('Font_Name'), local('Font_Name'), url(Font.woff) format('woff');
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400;
  src: local('Open Sans'), local('OpenSans'), url(http://themes.googleusercontent.com/static/fonts/opensans/v8/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff) format('woff');
}

要使用这样的字体,首先需要将其导入到CSS文件中。假设您已经在src/css中放置了样式表,在src/font中放置了code39.ttf(您可以从链接到的页面下载(,只需将其添加到样式表中即可。

@font-face {
    font-family: code39;
    src: url(../font/code39.ttf);
}

如果你已经这样做了,你的问题中的CSS代码应该可以工作了。祝你好运